GNOME Bugzilla – Bug 396157
GInitiallyUnowned-support in glibmm
Last modified: 2007-11-09 10:36:46 UTC
glibmm actually lacks support for GInitiallyUnowned. Implementing this shouldn´t be too difficult, as almost the same functionality already exists in Gtk::Object of gtkmm. I´ve attached my implementation, but I´m not sure I´ve got everything right.
Created attachment 80185 [details] [review] Patch for glibmm with InitiallyUnowned-support
This needs more comments to explain what is happening. And the class needs doxygen documentation to explain when you might want to use this class, and how to use it. I believe there might be some special considerations due to initialization of base classes with virtual inheritance, but I guess that you have experience of that enough to describe it. Is this use of referenced_ just similar to the use in GtkObject? Is there anything in GtkObject that you needed to remove in this class? Minor whitespace errors: - There should be indenting in the .h file, as in the other files. - The indenting in the .cc file should be 2 spaces per indent.
Sorry for submitting the code this way. I´ll document it when I get time to do that. GtkObject is very similiar to GInitiallyUnowned, and so most of the code is similar. For me, the main difference is, if I got that right, the destruction system of GtkObject (using destruct-notifies etc.), which doesn´t exist for GInitiallyUnowned. This also was the only thing I removed.
An update would be nice.
Well, I don't really know if this is completely right or not, and it has been some time since I wrote this, so I should take another look at this. Basically it's just about moving some stuff of Gtk::Object to where it belongs: Glib::InitiallyUnowned. Then Gtk::Object should no longer derive from Glib::Object but Glib::InitiallyUnowned, as it does in the original libraries anyway. I think some serious testing is required to make sure this thing works well.
I think this is better dealt with by the new _DERIVES_INITIALLY_UNOWNED and _INITIALLY_UNOWNED_SINK macros: http://mail.gnome.org/archives/gtkmm-list/2007-November/msg00081.html I prefer not to make any dangerous changes to Gtk::Object.