Re: cannot register existing type `LINCConnection'



Hi Botond,

On Thu, 2003-07-03 at 14:37, Botond Botyanszki wrote:
> I'm working on a gtk2 input module that uses GConf to store its settings.
> If the input module is loaded twice I get a segfault caused by GConf.

	Ok - so this is most likely because the static variable used to store
the GType in the foo_get_type() method is re-initialized to 0 - so we
try to re-register the type.

	You walk into a whole can of worms here. I don't recall what the
official solution is; AFAIR there was some design I saw somewhere once
to make things like this work - Tim ?

	Regards,

		Michael.

> Basically this is what I have: 
> 
> void im_module_init(GTypeModule *module) {
> 	gconf_client = gconf_client_get_default();
> 	g_object_unref(G_OBJECT(gconf_client));
> 	im_ja_register_type(module);
> }
> 
> When the client application loads, I select the input module from the
> menu. It works as expected until I select it again or some other input
> method. 
> The application crashes eventhough I have eliminated all other gconf
> related functions calls from my input module code, except for the above 2
> lines. Without the gconf code I don't get a segfault.
> 
> The weird thing is that if the module is preloaded with the GTK_IM_MODULE
> env variable this bug is not triggered, I can switch between the input
> modules as many times as I want.
> 
> 
> If the same input module is loaded again, this is what I get:
> 
> (testapp:810): GLib-GObject-WARNING **: cannot register existing type
> `LINCConnection'
> 
> (testapp:810): GLib-GObject-CRITICAL **: file gtype.c: line 1872
> (g_type_register_static): assertion `parent_type > 0' failed
> 
> (testapp:810): GLib-GObject-CRITICAL **: file gobject.c: line 615
> (g_object_new): assertion `G_TYPE_IS_OBJECT (object_type)' failed
> 
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 16384 (LWP 830)]
> 0x40a697d5 in giop_connection_set_orb_n_ver () from
> /usr/lib/libORBit-2.so.0
> 
> I'm attaching 2 backtraces also. The first was generated when selecting
> the same input module twice. The second is when selecting something else
> on the 2nd switch.
> 
> I'm using gconf 2.2.1 on debian unstable.
> 
> `ps jaxwww | grep gconf` gives
> 1  688  639  620 tty6 621 S 501 0:01  /usr/lib/gconf2/gconfd-2 11
> 
> 
> Any help would be appreciated.
-- 
 michael ximian com  <><, Pseudo Engineer, itinerant idiot




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