[nautilus/weak-refs: 34/34] toolbar: Fix window slot handling
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/weak-refs: 34/34] toolbar: Fix window slot handling
- Date: Wed, 30 May 2018 15:14:03 +0000 (UTC)
commit 6b1c03c4cbf40f6bdaccfc08773ef2f81eb4c942
Author: Ernestas Kulik <ernestask gnome org>
Date: Sat May 26 16:35:22 2018 +0300
toolbar: Fix window slot handling
Calling _set_window_slot() in the window slot weak ref notification
callback isn’t a good idea, given that most of the stuff being cleaned
up there is done automagically, and results in runtime warnings and a
segfault when disconnecting a signal handler from an instance that is no
longer valid.
Fixes https://gitlab.gnome.org/GNOME/nautilus/issues/441
src/nautilus-toolbar.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index e44b2ef54..dfae79998 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -989,8 +989,20 @@ on_window_slot_destroyed (gpointer data,
GObject *where_the_object_was)
{
NautilusToolbar *self = NAUTILUS_TOOLBAR (data);
+ GList *children;
+
+ self->window_slot = NULL;
+
+ children = gtk_container_get_children (GTK_CONTAINER (self->search_container));
+ if (children != NULL)
+ {
+ gtk_container_remove (GTK_CONTAINER (self->search_container),
+ children->data);
+ }
+
+ toolbar_update_appearance (self);
- nautilus_toolbar_set_window_slot (self, NULL);
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_WINDOW_SLOT]);
}
static void
@@ -1351,14 +1363,12 @@ nautilus_toolbar_set_window_slot (NautilusToolbar *self,
children = gtk_container_get_children (GTK_CONTAINER (self->search_container));
if (children != NULL)
{
- gtk_container_remove (GTK_CONTAINER (self->search_container),
- children->data);
+ gtk_container_remove (GTK_CONTAINER (self->search_container),
+ children->data);
}
if (self->window_slot != NULL)
{
- GTK_WIDGET (nautilus_window_slot_get_query_editor (self->window_slot));
- GTK_CONTAINER (self->search_container);
gtk_container_add (GTK_CONTAINER (self->search_container),
GTK_WIDGET (nautilus_window_slot_get_query_editor (self->window_slot)));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]