summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2018-05-03 17:57:08 +0200
committerCarlos Soriano <csoriano@gnome.org>2018-05-03 22:34:23 +0200
commit7831866d397a01297e6ed3a4a30cd66cde2a0484 (patch)
treefad28f628bb741533675101a44e5739c01476c58 /src
parentdeccd0151abfb27099e5e14628825a633b87c6b4 (diff)
downloadnautilus-7831866d397a01297e6ed3a4a30cd66cde2a0484.tar.gz
window-slot: Keep query editor ownership on the window-slot
So it stays alive between uses.
Diffstat (limited to 'src')
-rw-r--r--src/nautilus-query-editor.c2
-rw-r--r--src/nautilus-window-slot.c10
2 files changed, 10 insertions, 2 deletions
diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c
index a2291a87a..5ce439e68 100644
--- a/src/nautilus-query-editor.c
+++ b/src/nautilus-query-editor.c
@@ -746,7 +746,7 @@ nautilus_query_editor_get_query (NautilusQueryEditor *editor)
return NULL;
}
- return g_object_ref (priv->query);
+ return priv->query;
}
GtkWidget *
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 0f628a888..1ff5747f2 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -355,7 +355,6 @@ update_search_visible (NautilusWindowSlot *self)
{
nautilus_window_slot_set_search_visible (self, FALSE);
}
- g_object_unref (query);
}
if (priv->pending_search_text)
@@ -860,6 +859,9 @@ nautilus_window_slot_constructed (GObject *object)
gtk_widget_show (extras_vbox);
priv->query_editor = NAUTILUS_QUERY_EDITOR (nautilus_query_editor_new ());
+ /* We want to keep alive the query editor betwen additions and removals on the
+ * UI, specifically when the toolbar adds or removes it */
+ g_object_ref_sink (priv->query_editor);
gtk_widget_show (GTK_WIDGET (priv->query_editor));
g_object_bind_property (self, "location",
@@ -2856,6 +2858,12 @@ nautilus_window_slot_dispose (GObject *object)
g_clear_pointer (&priv->find_mount_cancellable, g_cancellable_cancel);
+ if (priv->query_editor)
+ {
+ gtk_widget_destroy (GTK_WIDGET (priv->query_editor));
+ g_clear_object (&priv->query_editor);
+ }
+
free_location_change (self);
G_OBJECT_CLASS (nautilus_window_slot_parent_class)->dispose (object);