diff options
author | Robert Nagy <robert@openbsd.org> | 2021-06-03 12:10:57 +0200 |
---|---|---|
committer | Robert Nagy <robert@openbsd.org> | 2021-06-03 12:10:57 +0200 |
commit | 374a77da17631567d5b2af31a43b57560946498d (patch) | |
tree | 3c9d0a542b357461efe556e0bcd8facc2a1aea58 | |
parent | 619f534a94991d8d125ed512e47b4af20d08eefc (diff) | |
download | ConsoleKit2-374a77da17631567d5b2af31a43b57560946498d.tar.gz |
do not unref an object which was not referenced before and
cleanup the code a bit to avoid confusion
-rw-r--r-- | src/ck-inhibit-manager.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/ck-inhibit-manager.c b/src/ck-inhibit-manager.c index 3173373..f044159 100644 --- a/src/ck-inhibit-manager.c +++ b/src/ck-inhibit-manager.c @@ -256,15 +256,12 @@ ck_inhibit_manager_remove_lock (CkInhibitManager *manager, for (l = g_list_first (priv->inhibit_list); l != NULL; l = l->next) { if (l->data && g_strcmp0 (ck_inhibit_get_named_pipe_path (l->data), named_pipe_path) == 0) { - CkInhibit *inhibit = l->data; - - /* Found it! Remove it from the list and unref the object */ - priv->inhibit_list = g_list_remove (priv->inhibit_list, inhibit); - ck_inhibit_remove_lock (inhibit); - g_signal_handlers_disconnect_by_func (inhibit, + /* Found it! Remove it from the list */ + ck_inhibit_remove_lock (l->data); + g_signal_handlers_disconnect_by_func (l->data, G_CALLBACK (cb_changed_event), manager); - g_object_unref (inhibit); + priv->inhibit_list = g_list_remove (priv->inhibit_list, l->data); return TRUE; } } |