DBus GObject & g_object_unref

Marc-André Lureau marcandre.lureau at gmail.com
Mon Jul 31 09:43:20 PDT 2006


Hi,

I am having troubles when calling g_object_unref() with a dbus registered
object.
Can someone tell me if I am doing something wrong...

I have traced a modified dbus-glib/dbus/examples/example-service.c with gdb,
without success.

This patch could explain what I want to do:

   1. diff --git a/dbus/examples/example-service.cb/dbus/examples/example-
   service.c
   2. index a66855c..8e39246 100644
   3. --- a/dbus/examples/example-service.c
   4. +++ b/dbus/examples/example-service.c
   5. @@ -101,6 +101,16 @@ some_object_get_dict (SomeObject *obj, G
   6.    return TRUE;
   7.  }
   8.
   9. +static gboolean
   10. +cb_1(gpointer data)
   11. +{
   12. +  SomeObject *obj;
   13. +
   14. +  obj = SOME_OBJECT (data);
   15. +  g_object_unref (obj) ;
   16. +  return FALSE;
   17. +}
   18. +
   19.  int
   20.  main (int argc, char **argv)
   21.  {
   22. @@ -147, 6 +157,7 @@ main (int argc, char **argv)
   23.
   24.    printf ("service running\n");
   25.
   26. +  g_timeout_add (1000 , cb_1, obj);
   27.    g_main_loop_run (mainloop);
   28.
   29.    exit (0);

And the step-by-step session with gdb & dbus-monitor:
http://pastebin.ca/108652

Unfortunately, after g_object_unref, the service is still there...
 dbus_g_proxy_new_for _name_owner is notified once the program is dead...
but I would like to be notified before :)

org_freedesktop_DBus_release_name() does not help me neither :(

I am running dapper, with 0.60 version of DbUs  (you haven't see that one
before, have you?)
And I have tested it on DBus 0.92..

What should I do instead ?

cheers,


-- 
Marc-André Lureau, GSmartMix
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/dbus/attachments/20060731/e4b02e2f/attachment.html


More information about the dbus mailing list