[maemo-developers] Debugging applet causing hildon-home crash

From: Jan Arne Petersen jpetersen at jpetersen.org
Date: Sat Jan 9 16:06:42 EET 2010
Hi,

On 01/09/2010 02:52 PM, Graham Cobb wrote:
> On Thursday 07 January 2010 15:48:34 Anderson Lizardo wrote:
>> 2010/1/7 Kimmo Hämäläinen<kimmo.hamalainen at nokia.com>:
>>> On Wed, 2010-01-06 at 22:46 +0100, ext Graham Cobb wrote:
>>>> In Fremantle, the GPE Summary applet causes hildon-home to crash if it
>>>> is removed and then re-added.  I have not been able to work out what the
>>>> problem is.
>>>
>>> We had several of this kind of crashes that happen when you remove and
>>> add it back. Usually the problem was in the Glib types that the applet
>>> uses: if it tries to register new types that are already there, or
>>> something similar.  I guess Glib should print out some warnings for you?
>>> (notice that hildon-home probably closes stdout by default)
>>
>> As a side note, python-hildon suffered from these issues because the
>> latest hildon-home (or hildon-desktop?) versions seemed to incorporate
>> some gtype registration functions which were missing before (i.e. ones
>> usually generated by glib-mkenums). The python bindings tried to
>> register the same types again, which caused problems (the errors shown
>> on console gave a hint about this).
>
> I can now reliably unload my plugin but I cannot add it back again.
>
> I hit this GType problem.  My plugin (actually some of the libraries it relies
> on) use GTypes.  So, of course, they register them.  When reloaded, the
> attempt to register them again fails (and generates warning messages).  But
> the functions for the type are now associated with code which has been
> unmapped from memory!  So, when I use one of the types it crashes.
>
> As there is no way (that I am aware of) for GTypes to be unregistered, or to
> be reregistered, is there some way for me to stop hildon-home actually
> unmapping my code? At least that would mean that the plugin could be re-added
> to the desktop, although no newer version would be usable until a reboot.

You could define a g_module_check_init like this:

const gchar *
g_module_check_init (GModule *module)
{
     g_module_make_resident(module);

     return NULL;
}

to prevent the module of being unloaded (see 
http://maemo.org/api_refs/5.0/5.0-final/glib/glib-Dynamic-Loading-of-Modules.html#glib-Dynamic-Loading-of-Modules.description).

Best regards,
Jan Arne
More information about the maemo-developers mailing list