Cancel construction of GObject



Is it possible to "cancel" construction in gobject-derived class?

Lets say I have GMyObject derived from GObject. In its init function I need to spawn a thread. When that fails, I would like to cancel construction of the object (so that gobjectclass' finalize function would be called on the object and g_object_new would return null-pointer).

I know I can create extra function, which would call g_type_new and spawn the thread then and destroy the object if it fails, but I would like my object to be instantiable by g_object_new and not force user to call extra initialization function and destroy the object if it fails.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]