diff options
author | Ernestas Kulik <ernestask@gnome.org> | 2018-10-06 19:57:09 +0300 |
---|---|---|
committer | Carlos Soriano <csoriano1618@gmail.com> | 2018-10-09 07:29:41 +0000 |
commit | 692d431a047c8889e201efe321c099b01bae71cd (patch) | |
tree | 30a1ce8e4bf83c1c7d4ab88558e4049c3f51b421 /src | |
parent | 0718606dcaad6599fe184f2e947a0018a8c86625 (diff) | |
download | nautilus-692d431a047c8889e201efe321c099b01bae71cd.tar.gz |
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).
Diffstat (limited to 'src')
-rw-r--r-- | src/nautilus-tag-manager.c | 22 |
1 files 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 |