GNOME Bugzilla – Bug 729152
g_bus_unwatch_name() unconditionally disconnects signal handlers (can cause warnings)
Last modified: 2018-05-24 16:29:31 UTC
If the GDBusConnection has been disposed between g_bus_watch_name() and g_bus_unwatch_name(), when the latter function tries to disconnect its handler on the GDBusConnection for the "closed" signal, the client code will get a warning. This can result in an error if the environment is set up to promote warnings to errors as in bug #726973, where this causes many tests to fail. I think it may also make sense to change gsignal to not issue warnings for excessive disconnections (which could make the fix for this bug even simpler).
Created attachment 275386 [details] [review] Only clear out GDBusConnection:closed handler if the connection has not been disposed
(In reply to comment #0) > I think it may also make sense to change gsignal to not issue warnings for > excessive disconnections (which could make the fix for this bug even simpler). As I said on the original bug, the problem with this is that if the numeric signal ID has been reused (perhaps by someone resurrecting the object during dispose), you're accidentally disconnecting someone else's signal. One possible opinion on this bug would be "it is never right to call g_object_run_dispose() on the GDBusConnection", in which case GTestDBus shouldn't do that (but then we need some other way to make sure all its refs get released). (In reply to comment #1) > Only clear out GDBusConnection:closed handler if the connection has not been > disposed Note that this patch only works for our situation if either Bug #729150 has also been fixed, or g_object_run_dispose() is not called. At the moment, g_object_run_dispose() doesn't invalidate a GWeakRef. If the connection has been "really disposed" by reaching 0 refs, rather than being forced to dispose via g_object_run_dispose(), then I think this patch is OK (although I haven't reviewed in detail).
This might be a dup of Bug #726978, or at least related.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/866.