GNOME Bugzilla – Bug 326512
Patch to correct XML construct from buffer
Last modified: 2011-01-16 23:33:32 UTC
The existing XML construct from buffer does not attach the new objects to the correct base object. This results in not being able to register for events on the base object, since they are not passed in. The problem is its use of glade_xml_new_from_buffer, which creates a new object instead of attaching to the existing one. Bug 326511 has been entered with a patch to add glade_xml_construct_from_buffer to libglade. This patch switches the XML construct from buffer method to use that new method, thereby fixing the problem. Here is the patch: --- libglademm-2.6.1/libglade/libglademm/xml.cc 2006-01-09 18:27:30.000000000 -0500 +++ libglademm-2.6.1/libglade/libglademm/xml.cc_new 2006-01-09 18:27:15.000000000 -0500 @@ -70,15 +70,16 @@ } } -// TODO: we need glade_xml_construct_from_buffer() Xml::Xml(const char* buffer, int size, const Glib::ustring& root, const Glib::ustring& domain) : - Glib::ObjectBase(0), - Glib::Object((GObject*) glade_xml_new_from_buffer( - buffer, size, root.empty() ? 0 : root.c_str(), domain.empty() ? 0 : domain.c_str())) -{ - if(!gobj()) + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Glib::Object(Glib::ConstructParams(xml_class_.init(), (char*) 0)) +{ + if(!glade_xml_construct_from_buffer(gobj(), buffer, size, root.empty() ? 0 : root.c_str(), + domain.empty() ? 0 : domain.c_str())) + { throw XmlError("Failed to read glade input buffer"); + } } // static
By the way, is this needed for an application of yours? Should we try to get it in before the GNOME 2.13/14 API freeze?
It would be nice if it made it into 2.14. It is required for a DoD application we are developing. We are currently running against versions locally patched with this enhancement.
Can this patch now be applied, since 326511 has been applied to version 2.18?
Yeah, I'll branch and do that soon. Keep reminding me if I don't. Thanks.
I believe this patch can now be applied.
Yes. Committed after branching. Please remember to create an svn patch (not patching generated files) with a ChangeLog entry next time. I am asking for a libglade tarball release so I can do a libglademm release that has this.