[gnome-calendar/gnome-3-36] window: Remove subscribers on destroy



commit 4958de25f70d1842fc5d39ad9872c98097510b2b
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Apr 1 23:08:34 2020 -0300

    window: Remove subscribers on destroy

 src/gui/gcal-window.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
---
diff --git a/src/gui/gcal-window.c b/src/gui/gcal-window.c
index 7f1a646d..1bca64dd 100644
--- a/src/gui/gcal-window.c
+++ b/src/gui/gcal-window.c
@@ -1,7 +1,7 @@
 /* gcal-window.c
  *
  * Copyright (C) 2015 Erick PĂ©rez Castellanos <erickpc gnome org>
- * Copyright (C) 2014 Georges Basile Stavracas Neto <georges stavracas gmail com>
+ * Copyright (C) 2014-2020 Georges Basile Stavracas Neto <georges stavracas gmail com>
  *
  * gnome-calendar is free software: you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
@@ -979,6 +979,22 @@ gcal_window_get_property (GObject    *object,
  * GtkWidget overrides
  */
 
+static void
+gcal_window_destroy (GtkWidget *widget)
+{
+  GcalTimeline *timeline;
+  GcalWindow *self;
+
+  self = GCAL_WINDOW (widget);
+
+  timeline = gcal_manager_get_timeline (gcal_context_get_manager (self->context));
+  gcal_timeline_remove_subscriber (timeline, GCAL_TIMELINE_SUBSCRIBER (self->week_view));
+  gcal_timeline_remove_subscriber (timeline, GCAL_TIMELINE_SUBSCRIBER (self->month_view));
+  gcal_timeline_remove_subscriber (timeline, GCAL_TIMELINE_SUBSCRIBER (self->year_view));
+
+  GTK_WIDGET_CLASS (gcal_window_parent_class)->destroy (widget);
+}
+
 static gboolean
 gcal_window_configure_event (GtkWidget         *widget,
                              GdkEventConfigure *event)
@@ -1021,6 +1037,7 @@ gcal_window_class_init (GcalWindowClass *klass)
 
   widget_class = GTK_WIDGET_CLASS (klass);
   widget_class->configure_event = gcal_window_configure_event;
+  widget_class->destroy = gcal_window_destroy;
 
 
   properties[PROP_ACTIVE_DATE] = g_param_spec_boxed ("active-date",


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