GNOME Bugzilla – Bug 708042
gapplication: don't rely on cmdline being finalized immediately
Last modified: 2013-10-17 12:24:11 UTC
See attached patch
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.
Created attachment 254883 [details] [review] gapplication: don't rely on cmdline being finalized immediately -- Correct patch this time.
It looks like we might be able to mark bug 682331 as a dup of this (since this has a patch)?
Ryan, what do you think about this one? It looks fine to me.
*** Bug 682331 has been marked as a duplicate of this bug. ***
Attachment 254883 [details] pushed as c574832 - gapplication: don't rely on cmdline being finalized immediately
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 ***