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 708042 - gapplication: don't rely on cmdline being finalized immediately
gapplication: don't rely on cmdline being finalized immediately
Status: RESOLVED DUPLICATE of bug 682331
Product: glib
Classification: Platform
Component: gapplication
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2013-09-13 20:25 UTC by Cosimo Cecchi
Modified: 2013-10-17 12:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gapplication: don't rely on cmdline being finalized immediately (3.30 KB, patch)
2013-09-13 20:26 UTC, Cosimo Cecchi
none Details | Review
gapplication: don't rely on cmdline being finalized immediately (3.33 KB, patch)
2013-09-13 20:28 UTC, Cosimo Cecchi
committed Details | Review

Description Cosimo Cecchi 2013-09-13 20:25:59 UTC
See attached patch
Comment 1 Cosimo Cecchi 2013-09-13 20:26:00 UTC
Created attachment 254882 [details] [review]
gapplication: don't rely on cmdline being finalized immediately

The GApplicationCommandLine DBus implementation currently calls
g_dbus_method_invocation_return_value() in its finalize() implementation
only, relying on the object being destroyed after g_object_unref() is
called on it inside g_application_impl_method_call().

While this is usually fine for C applications, when overriding the
command_line vfunc from language bindings, the binding might add extra
references to the object, which might not be released immediately - e.g.
because they're garbage collected, or possibly even leaked. The same
scenario could happen in a C application that decides to keep a
reference to the passed-in GApplicationCommandLine object.

To ensure the CommandLine DBus method always gets a reply after the
invocation of command_line in the primary instance, explicitly send the
message back before dropping our reference to the object.
Comment 2 Cosimo Cecchi 2013-09-13 20:28:55 UTC
Created attachment 254883 [details] [review]
gapplication: don't rely on cmdline being finalized immediately

--

Correct patch this time.
Comment 3 Simon Feltman 2013-09-13 21:22:56 UTC
It looks like we might be able to mark bug 682331 as a dup of this (since this has a patch)?
Comment 4 Colin Walters 2013-09-18 12:54:48 UTC
Ryan, what do you think about this one?  It looks fine to me.
Comment 5 Matthias Clasen 2013-10-17 03:05:30 UTC
*** Bug 682331 has been marked as a duplicate of this bug. ***
Comment 6 Matthias Clasen 2013-10-17 03:11:36 UTC
Attachment 254883 [details] pushed as c574832 - gapplication: don't rely on cmdline being finalized immediately
Comment 7 Allison Karlitskaya (desrt) 2013-10-17 12:24:11 UTC
Reverted for broken-by-design.  The entire point of this is that the remote instance should not exit until the last reference drops on the commandline object -- specifically, we should be able to keep the remote instance alive past the handler returning.

*** This bug has been marked as a duplicate of bug 682331 ***