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.
This commit is contained in:
Georges Basile Stavracas Neto
2016-02-22 00:02:59 -03:00
parent e4bfdb7ed2
commit e067e8cf73
+4
View File
@@ -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);