libhal apps exit on message bus restart

Sjoerd Simons sjoerd at luon.net
Fri Dec 3 08:25:22 PST 2004


On Fri, Dec 03, 2004 at 04:08:42PM +0000, Tim Müller wrote:
> On Monday 29 November 2004 12:32, Martin Pitt wrote:
> 
> > > I noticed that my libhal-using apps just exit silently when the system
> > > message bus (and with it hald) is restarted.
> > >    [...]
> > > What's the recommended way to work around this in applications?
> >
> > Ubuntu had this problem particularly with gnome-volume-manager. We
> > submitted the patch to the Gnome BTS
> >
> >   http://bugzilla.gnome.org/show_bug.cgi?id=153673
> >
> > The patch is g-v-m specific, but you might get the general idea also
> > for other applications.
> 
> Thanks, I gave that a shot, and it seems to work if I don't call 
> hal_shutdown() on the old libhal context (dbus 0.22-3, hal 0.4.2-1).
> 
> It would be great if someone could add a warning comment about this behaviour 
> to the libhal/hal_initialize() API docs. I'd be surprised if I was the only 
> app programmer not expecting libhal to behave like this.

The one in gnome bts is an older patch. Never came around to posting the new
patch, upstream seems to ignore our patches anyway...

The problem with the old patch was that the dbus connection was unreffed before
the hal_shutdown call. And the hal_shutdown call, does some operations on the
old dbus connection :).. Simply reordering things solves this (thus first
shutdown your old hal context and then unref the old dbus connection).

The libhal api can be improved imho by allowing application to pass it the dbus
connection instead of always setting it up itself and doing the referencing
right. Currently in debian/ubuntu's gvm patch we assume that hal_shutdown
doesn't unref the dbus connection, while that would be the right behaviour
imho.

  Sjoerd
-- 
At ebb tide I wrote a line upon the sand, and gave it all my heart and all
my soul.  At flood tide I returned to read what I had inscribed and found my
ignorance upon the shore.
		-- Kahlil Gibran
_______________________________________________
hal mailing list
hal at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/hal



More information about the Hal mailing list