After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 621905 - Should assume a reference to the object when asynchronously getting the dbus connection
Should assume a reference to the object when asynchronously getting the dbus ...
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gdbus
2.25.x
Other Linux
: Normal normal
: ---
Assigned To: David Zeuthen (not reading bugmail)
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-06-17 16:38 UTC by Cosimo Cecchi
Modified: 2010-06-17 16:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (1.07 KB, patch)
2010-06-17 16:38 UTC, Cosimo Cecchi
committed Details | Review

Description Cosimo Cecchi 2010-06-17 16:38:26 UTC
GDBusProxy should assume a reference to the object when it asynchronously initializes itself, as g_async_initable_new_valist_async() drops the reference it gives to g_async_initable_init_async() just after the call

332   g_async_initable_init_async (G_ASYNC_INITABLE (obj),
333                                io_priority, cancellable,
334                                callback, user_data);
335   g_object_unref (obj); /* Passed ownership to async call */

The result is that e.g. nautilus segfaults like this

(gdb) bt
  • #0 IA__g_logv
    at gmessages.c line 555
  • #1 IA__g_log
    at gmessages.c line 569
  • #2 IA__g_return_if_fail_warning
  • #3 IA__g_object_unref
    at gobject.c line 2500
  • #4 g_dbus_proxy_finalize
    at gdbusproxy.c line 156
  • #5 IA__g_object_unref
    at gobject.c line 2565
  • #6 IA__g_async_initable_new_valist_async
    at gasyncinitable.c line 334
  • #7 IA__g_async_initable_new_async
    at gasyncinitable.c line 243
  • #8 IA__g_dbus_proxy_new_for_bus
    at gdbusproxy.c line 1763
  • #9 ck_get_current_session_cb
    at nautilus-application.c line 625

Comment 1 Cosimo Cecchi 2010-06-17 16:38:50 UTC
Created attachment 163934 [details] [review]
patch
Comment 2 David Zeuthen (not reading bugmail) 2010-06-17 16:44:34 UTC
Looks good to me with two stylistic simple fixes

 - please include the bug number in the Subject line e.g. like this
   "Bug 621905 –" (notice the wider dash). Also, no trailing dot
   in the commit message and please keep it under chars 72); and

 - please include the bug url in the Body

since that will make it easier for future archaeologist to figure out what's going on. Thanks!
Comment 3 Cosimo Cecchi 2010-06-17 16:50:26 UTC
Thanks, pushed to master with this commit message.

commit b3cc28bc34bd0b341f1786dc478cff259ce5d1da
Author: Cosimo Cecchi <cosimoc@gnome.org>
Date:   Thu Jun 17 18:26:15 2010 +0200

    Bug 621905 – Assume a ref when doing async work
    
    When asynchronously acquiring the DBus connection, assume a reference to
    the proxy object, to avoid destroying it in the middle of the operation.
    
    See https://bugzilla.gnome.org/show_bug.cgi?id=621905