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

From: Graham Cobb g+770 at cobb.uk.net
Date: Sat Jan 9 15:43:21 EET 2010
On Thursday 07 January 2010 15:48:34 Anderson Lizardo wrote:
> 2010/1/7 Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>:
> > 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)
> I usually also debug on scratchbox/x86 , where I can kill hildon-home
> and restart it again with
> hildon-home &
> which then shows debug messages on the console.

Thanks for the hints -- very useful.  I have already found and fixed several 
bugs with unloading the plugin!

A couple of notes for future reference for anyone who is searching for 
hildon-home crashes when unloading an HDHomePluginItem home widget...

1) HDHomePluginItem provides a useful optimised timer capability 
(hd_home_plugin_item_heartbeat_signal_add) but if you use this, you WILL 
crash hildon-home when your plugin is unloaded, unless you destroy the event 
source in your class finalize function.  For example, in gpesummary I have 

if (current_timer) 

This should really be added to the documentation for 
hd_home_plugin_item_heartbeat_signal_add (reported in bug 4337).

2) Make sure that any libraries you use are not running any timers (or any 
other callbacks) which could fire later.  For example, in gpesummary, I have 
to explicitly close the event database as otherwise libeventdb leaves a timer 
running which will cause a crash when it fires (of course, that is good 
practice anyway in order to free up the memory!).

Maybe hildon-home should be using a separate GMainContext for each plugin -- 
would that mean it could automatically destroy all the event sources 
associated with the plugin before unloading it?

More information about the maemo-developers mailing list