Sort out dbus-glib registration mess
authorDavid Zeuthen <davidz@redhat.com>
Fri, 19 Jun 2009 22:26:01 +0000 (18:26 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Fri, 19 Jun 2009 22:26:01 +0000 (18:26 -0400)
commit3f8f7c0983f2a081e194ca3620500ed023bb9088
tree9209acff6f6b7eb363c742c846b77b3f40d6192c
parentcf9ec37fab9e1db9a334091f60ce049943ad1b85
Sort out dbus-glib registration mess

We sometimes segfaulted when stopping a RAID device. The problem here
was that we kept the exported D-Bus object around until it was
finalized (by using weak refs). This was problematic because several
change events were treated as add events but the state of the RAID
device was such that we didn't want to add the object anyway. So we
ended up unreffing the object. Which means that the job completion
func accessed a unreferenced object.

The solution here is to remove the object from our hashes as soon as
we want to remove it.

Since we don't have dbus_g_connection_unregister_g_object() just yet
(available in dbus-glib >= 0.81) we just keep the object on the
bus. If we later wants to add a new object but the old object is still
around we use an undocumented hack to unregister the object.

You will also need eggdbus >= 0.5, otherwise introspection won't work.
src/devkit-disks-daemon.c
src/devkit-disks-device-private.c
src/devkit-disks-device-private.h
src/devkit-disks-device.c