Comment 5 for bug 1270073

Revision history for this message
suresh (suresh-meetsme) wrote :

@Markus,

Ok. I found in recent sp-object.cpp file new object is created using below statement
 SPObject* child = SPFactory::instance().createObject(typeString);

where in createObject function it return new SPObject(), however in old sp-object.cpp file object creating using
SPObject *child = SP_OBJECT(g_object_new(type, 0));
which later free by g_object_unref.

I studied this https://wiki.gnome.org/Projects/Vala/Ownership#Ownership_in_GLib and according when we call g_object_unref memory destroy, but in our case memory leak. I still not sure about memory leak by g_object_unref or something else as already there are patch available to fix some memory leak.

Is there any way to convert SPObject *child = SP_OBJECT(g_object_new(type, 0)); into SPObject* child = SPFactory::instance().createObject(typeString); as my c++ is not so strong.