From e067e8cf73b31bd776335dab78a5c87103f5df8a Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Thu, 18 Feb 2016 19:12:00 -0200 Subject: [PATCH] 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 file changed, 4 insertions(+) diff --git a/src/gcal-event-widget.c b/src/gcal-event-widget.c index 36ab9f9a..be1ca5b0 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);