summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Nagy <robert@openbsd.org>2021-06-03 12:10:57 +0200
committerRobert Nagy <robert@openbsd.org>2021-06-03 12:10:57 +0200
commit374a77da17631567d5b2af31a43b57560946498d (patch)
tree3c9d0a542b357461efe556e0bcd8facc2a1aea58
parent619f534a94991d8d125ed512e47b4af20d08eefc (diff)
downloadConsoleKit2-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.c11
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;
}
}