[gnome-software/wip/ubuntu-changes] Nullify widgets on destroy



commit 70747feb6cb715c9e377a31a5aacb93aac84780a
Author: William Hua <william hua canonical com>
Date:   Mon Mar 21 16:22:41 2016 -0400

    Nullify widgets on destroy

 src/gs-shell-installed.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/src/gs-shell-installed.c b/src/gs-shell-installed.c
index 813843d..305ffec 100644
--- a/src/gs-shell-installed.c
+++ b/src/gs-shell-installed.c
@@ -194,8 +194,11 @@ gs_shell_installed_get_installed_cb (GObject *source_object,
        g_autoptr(GError) error = NULL;
        g_autoptr(GsAppList) list = NULL;
 
-       gs_stop_spinner (GTK_SPINNER (self->spinner_install));
-       gtk_stack_set_visible_child_name (GTK_STACK (self->stack_install), "view");
+       if (self->spinner_install != NULL)
+               gs_stop_spinner (GTK_SPINNER (self->spinner_install));
+
+       if (self->stack_install != NULL)
+               gtk_stack_set_visible_child_name (GTK_STACK (self->stack_install), "view");
 
        self->waiting = FALSE;
        self->cache_valid = TRUE;
@@ -242,8 +245,12 @@ gs_shell_installed_load (GsShellInstalled *self)
                                              self->cancellable,
                                              gs_shell_installed_get_installed_cb,
                                              self);
-       gs_start_spinner (GTK_SPINNER (self->spinner_install));
-       gtk_stack_set_visible_child_name (GTK_STACK (self->stack_install), "spinner");
+
+       if (self->spinner_install != NULL)
+               gs_start_spinner (GTK_SPINNER (self->spinner_install));
+
+       if (self->stack_install != NULL)
+               gtk_stack_set_visible_child_name (GTK_STACK (self->stack_install), "spinner");
 }
 
 /**
@@ -781,6 +788,9 @@ gs_shell_installed_init (GsShellInstalled *self)
 {
        gtk_widget_init_template (GTK_WIDGET (self));
 
+       gtk_widget_destroyed (self->spinner_install, &self->spinner_install);
+       gtk_widget_destroyed (self->stack_install, &self->stack_install);
+
        self->sizegroup_image = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
        self->sizegroup_name = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]