[gnome-software/gnome-3-30] updates section: Fix a crash during automatic updates
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-3-30] updates section: Fix a crash during automatic updates
- Date: Tue, 25 Sep 2018 09:04:28 +0000 (UTC)
commit 1123fc250b70406b0bac7df48454bcf8a7fccb98
Author: Kalev Lember <klember redhat com>
Date: Sun Sep 23 19:11:13 2018 +0200
updates section: Fix a crash during automatic updates
When self->list is cleared, a bunch of variables pointing to items
constructed in _build_section_header() become invalid. Make sure that we
set those to NULL when self->list is cleared so that we can avoid using
dangling pointers in callbacks.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1632029
src/gs-updates-section.c | 11 +++++++++++
1 file changed, 11 insertions(+)
---
diff --git a/src/gs-updates-section.c b/src/gs-updates-section.c
index c17d5789..40ea5cc5 100644
--- a/src/gs-updates-section.c
+++ b/src/gs-updates-section.c
@@ -109,6 +109,14 @@ gs_updates_section_remove_all (GsUpdatesSection *self)
GtkWidget *w = GTK_WIDGET (l->data);
gtk_container_remove (GTK_CONTAINER (self), w);
}
+
+ /* the following are set in _build_section_header(); clear these so
+ * that they don't become dangling pointers once all items are removed
+ * from self->list */
+ self->button = NULL;
+ self->button_cancel = NULL;
+ self->button_stack = NULL;
+
gs_app_list_remove_all (self->list);
gtk_widget_hide (GTK_WIDGET (self));
}
@@ -503,6 +511,9 @@ gs_updates_section_progress_notify_cb (GsAppList *list,
GParamSpec *pspec,
GsUpdatesSection *self)
{
+ if (self->button_cancel == NULL)
+ return;
+
gs_progress_button_set_progress (GS_PROGRESS_BUTTON (self->button_cancel),
gs_app_list_get_progress (list));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]