Hi, I'm having a somewhat complicated problem with my gtkmm-based app segfaulting and I've run out of ideas on how to debug it and figure out what's wrong, so I was hoping you'd have some ideas for me... My app is Gtkmm-based and dynamically loads plugins via g_module_open(), some of which have a GUI component using Gtkmm. One of those, again, gets its GUI component via Gnome::Glade::XML, passing a hardcoded XML string to it (not necessarily the nicest way of doing that I suppose, but that's not my code :). Under the assumption that someone working on a plugin may want to recompile the plugin but not restart the main app, the app provides a Reload button which unloads and then reopens the plugin libs, and re-instantiates those plugins currently in use. If the Glade-using plugin is currently instantiated and then Reload is pressed, the following happens: --8<------------ Reloading plugin >Hreader< Reloading plugin >Hgldisplay< Reloading plugin >Hsaver< Reloading plugin >Skeletonplugin< (mvis:20067): GLib-GObject-WARNING **: cannot register existing type `GladeXML' (mvis:20067): GLib-GObject-CRITICAL **: g_object_new: assertion `G_TYPE_IS_OBJECT (object_type)' failed Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1223374624 (LWP 20067)] 0xb6fe6b50 in glade_xml_new_from_buffer () from /usr/lib/libglade-2.0.so.0 (gdb) bt #0 0xb6fe6b50 in glade_xml_new_from_buffer () from /usr/lib/libglade-2.0.so.0 #1 0xb6ff9b5a in Gnome::Glade::Xml::Xml () from /usr/lib/libglademm-2.4.so.1 #2 0xb6ff9fb8 in Gnome::Glade::Xml::create_from_buffer () from /usr/lib/libglademm-2.4.so.1 #3 0xb705c7c9 in HModuleGuiGlade::createGUI<Gtk::VBox> (this=0x8281390, xmlstring=0xb7060720 "<?xml version=\"1.0\" standalone=\"no\"?><!--*- mode: xml -*--><!DOCTYPE glade-interface SYSTEM\"http://glade.gnome.org/glade-2.0.dtd\"><glade-interface><widgetclass=\"GtkWindow\" id=\"window1\"> <property "...,widgetname= 0xbfffd7e8) at hmoduleguiglade.h:43 #4 0xb7057d35 in HReaderGui (this=0x8281390, threadconf= 0xbffff910,pmodulename= 0xbfffddcc) at ../hreadergui.cpp:132 #5 [...] ------------>8-- Now after long and tedious searching I didn't find anything obviously wrong with my code, especially given that the code related to reloading hasn't changed in a while and used to work. Just much of the plugin structure was changed. So I went at looked for anything suspicious in the backtrace and then ran the thing through valgrind, but I couldn't find anything unusual. The segfault seems to be caused by the fact that the assertion above results in null being returned, and the caller then tries to dereference that null pointer. It seems that my code doesn't accidentally foul up its memory with the result of creating this error. I've googled around for the "cannot register existing type" warning as well and haven't found anything useful. But I suppose that nevertheless I'm doing something wrong in between deleting plugin objects, unloading and reloading the plugin libs, and re-instantiating the plugin classes. I just don't know where to look anymore. I've tested this on - Debian testing running Linux 2.6.11, libgtkmm-2.4, libglademm-2.4 on an Intel P4 - Debian testing running Linux 2.4.24, libgtkmm-2.4, libglademm-2.4 on an Athlon XP Do you guys have any ideas on where I should be looking? Tell me if you need more details. Thanks in advance and best wishes, Jan Oberländer PS. I'm not currently subscribed to this list. -- +-------------------------------------+ | Jan Oberländer <mindriot gmx net> | | PGP key: 0xC4D910E3 | +-------------------------------------+
Attachment:
signature.asc
Description: Digital signature