After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 476703 - lookup_type_vfunc called in constructor
lookup_type_vfunc called in constructor
Status: RESOLVED WONTFIX
Product: libglademm
Classification: Other
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2007-09-13 20:24 UTC by Armin Burgmeier
Modified: 2011-01-16 23:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (14.82 KB, patch)
2007-09-13 20:29 UTC, Armin Burgmeier
none Details | Review

Description Armin Burgmeier 2007-09-13 20:24:36 UTC
The Glade::Xml class has a lookup_type_vfunc that allows derived classes to override the GType to create for a certain type name. This is, however, called from glade_xml_construct, in turn called by the Glade::Xml constructor. If a derived class overrides the virtual method, if will not be called, because the constructor of the derived class has not yet run. This makes it impossible to override lookup_type_vfunc in C++.
Comment 1 Armin Burgmeier 2007-09-13 20:29:12 UTC
Created attachment 95546 [details] [review]
Proposed patch

The patch adds a default constructor and a new static init() function that does the actual initialization via glade_xml_construct. A derived classes create functions should then do this:

return init(new DerivedXml, filename, root, domain);

The current constructors are kept for compatibility reasons.
Comment 2 Murray Cumming 2007-09-14 09:16:35 UTC
Well spotted.

Does anyone actually need to ovveride this vfunc?
Comment 3 Armin Burgmeier 2007-09-14 10:18:41 UTC
I am using it in the glom maemo port to create a HildonWindow instead of a GtkWindow for the main window.
Comment 4 Murray Cumming 2007-09-14 10:24:10 UTC
That seems like an unpleasant hack. I would prefer an alternative in Glom, such as removing the widget from the GtkWindow and inserting it in the HildonWindow.
Comment 5 Armin Burgmeier 2007-09-14 11:20:46 UTC
It looked like the most straight-forward way doing it to me. However, I just tried out, and reparenting seems to work equally well. Should this problem in libglademm still be fixed, or should we just hide the vfunc from the public (which would probably mean making it a private member, to not break ABI)?
Comment 6 Murray Cumming 2007-09-14 11:25:58 UTC
I'm not sure. Let's keep this bug open for now.
Comment 7 Murray Cumming 2009-01-07 21:37:04 UTC
This really doesn't seem very useful. Closing.