g_type_register_static causes crash in gtk im module.



Hi,

I meet a trouble with in gtk immodule. I known I should use g_type_register_dynamic in the module. But my gtk module is linked with another library based on glib. It uses g_type_register_static to register its classes. When a gtk application loads my im module twice, it will cause crash, and give some error output.

GLib-GObject-WARNING **: cannot register existing type `IBusObject'

I found it could be fixed by changing the args of g_module_open (Please check below patch). I want to know if I could avoid this problem without modify gtk. Thanks.

--- gtk+-2.14.4/gtk/gtkimmodule.c.old    2008-10-26 14:17:00.000000000 +0800
+++ gtk+-2.14.4/gtk/gtkimmodule.c    2008-10-26 14:17:13.000000000 +0800
@@ -98,7 +98,7 @@
  
   if (!im_module->builtin)
     {
-      im_module->library = g_module_open (im_module->path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
+      im_module->library = g_module_open (im_module->path, G_MODULE_BIND_LAZY/* | G_MODULE_BIND_LOCAL */);
       if (!im_module->library)
     {
       g_warning ("%s", g_module_error());

Thanks
Peng Huang


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]