Re: g_type_register_static causes crash in gtk im module.



On Sun, 2008-10-26 at 14:30 +0800, Peng Huang wrote:
> Hi,
> 
> I meet a problem 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.

That patch won't help, you *must*not* unload the code of a type
registered
with register_static().

Use g_module_make_resident() to keep the module from being unloaded.

ciao,
--mitch




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