[gnome-calendar] event-widget: disconnect from event's signals on finalize



commit e067e8cf73b31bd776335dab78a5c87103f5df8a
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Feb 18 19:12:00 2016 -0200

    event-widget: disconnect from event's signals on finalize
    
    When we finalize, we remove the event. Normally this means
    that the event also gets finalized, as the widget almost
    always holds the only reference to the event.
    
    However, there are some rare cases where we finalize the widget
    but not the event. If the event the updates the color or the
    summary, we try to redraw the finalized widget and crash.
    
    Fix that by disconnecting the signals when finalizing the widget.

 src/gcal-event-widget.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/gcal-event-widget.c b/src/gcal-event-widget.c
index 36ab9f9..be1ca5b 100644
--- a/src/gcal-event-widget.c
+++ b/src/gcal-event-widget.c
@@ -253,6 +253,10 @@ gcal_event_widget_finalize (GObject *object)
 
   self = GCAL_EVENT_WIDGET (object);
 
+  /* disconnect signals */
+  g_signal_handlers_disconnect_by_func (self->event, update_color, self);
+  g_signal_handlers_disconnect_by_func (self->event, gtk_widget_queue_draw, self);
+
   /* releasing properties */
   g_clear_pointer (&self->css_class, g_free);
   g_clear_object (&self->event);


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