[nautilus/wip/ernestask/leak-plugging: 6/9] tag-manager: Guard against null notifier
- From: Ernestas Kulik <ernestask src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/ernestask/leak-plugging: 6/9] tag-manager: Guard against null notifier
- Date: Sat, 6 Oct 2018 17:50:45 +0000 (UTC)
commit d0245482d60528d503e411c6fb19a079bd98b28c
Author: Ernestas Kulik <ernestask gnome org>
Date: Sat Oct 6 19:57:09 2018 +0300
tag-manager: Guard against null notifier
tracker_notifier_new() may return a null pointer on error, and that’s
exactly what happens sometimes (CI pipelines,
https://gitlab.gnome.org/GNOME/tracker/issues/43).
src/nautilus-tag-manager.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/src/nautilus-tag-manager.c b/src/nautilus-tag-manager.c
index de125ff77..78c81e0b6 100644
--- a/src/nautilus-tag-manager.c
+++ b/src/nautilus-tag-manager.c
@@ -818,9 +818,13 @@ nautilus_tag_manager_finalize (GObject *object)
self = NAUTILUS_TAG_MANAGER (object);
- g_signal_handlers_disconnect_by_func (self->notifier,
- G_CALLBACK (on_tracker_notifier_events),
- self);
+ if (self->notifier != NULL)
+ {
+ g_signal_handlers_disconnect_by_func (self->notifier,
+ G_CALLBACK (on_tracker_notifier_events),
+ self);
+ }
+
g_clear_object (&self->notifier);
g_hash_table_destroy (self->starred_files);
@@ -875,11 +879,13 @@ nautilus_tag_manager_set_cancellable (NautilusTagManager *self,
TRACKER_NOTIFIER_FLAG_QUERY_LOCATION,
cancellable,
&self->notifier_error);
-
- g_signal_connect (self->notifier,
- "events",
- G_CALLBACK (on_tracker_notifier_events),
- self);
+ if (self->notifier != NULL)
+ {
+ g_signal_connect (self->notifier,
+ "events",
+ G_CALLBACK (on_tracker_notifier_events),
+ self);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]