[nautilus/wip/ernestask/leak-plugging: 8/10] tag-manager: Guard against null notifier
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/ernestask/leak-plugging: 8/10] tag-manager: Guard against null notifier
- Date: Tue, 9 Oct 2018 07:30:28 +0000 (UTC)
commit 692d431a047c8889e201efe321c099b01bae71cd
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]