Fix GcalContext management

GObject automatically notifies when passing
properties as part of g_object_new(). This
happens after the instance is created, thus
after constructed().

By passing G_PARAM_EXPLICIT_NOTIFY, we avoid
this behavior. However, we are still notifying
PROP_CONTEXT in GcalWindow. Removing this other
notify fixes the crashes related to GcalContext.

https://gitlab.gnome.org/GNOME/gnome-calendar/issues/417
This commit is contained in:
Georges Basile Stavracas Neto
2019-10-04 20:54:05 -03:00
parent a0403b0b3e
commit 357ec18a0a
9 changed files with 29 additions and 35 deletions
+1 -2
View File
@@ -2182,6 +2182,7 @@ gcal_month_view_set_property (GObject *object,
break;
case PROP_CONTEXT:
g_assert (self->context == NULL);
self->context = g_value_dup_object (value);
for (i = 0; i < 42; i++)
@@ -2199,8 +2200,6 @@ gcal_month_view_set_property (GObject *object,
self,
0);
update_weather (self, TRUE);
g_object_notify (object, "context");
break;
default:
+1 -1
View File
@@ -54,7 +54,7 @@ gcal_view_default_init (GcalViewInterface *iface)
"The context",
"The context of the view",
GCAL_TYPE_CONTEXT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
/**
* GcalView::create-event:
+1 -2
View File
@@ -570,6 +570,7 @@ gcal_week_view_set_property (GObject *object,
break;
case PROP_CONTEXT:
g_assert (self->context == NULL);
self->context = g_value_dup_object (value);
gcal_week_grid_set_context (GCAL_WEEK_GRID (self->week_grid), self->context);
@@ -580,8 +581,6 @@ gcal_week_view_set_property (GObject *object,
G_CALLBACK (gtk_widget_queue_draw),
self->hours_bar,
G_CONNECT_SWAPPED);
g_object_notify (object, "context");
break;
default:
+1 -2
View File
@@ -1744,6 +1744,7 @@ gcal_year_view_set_property (GObject *object,
break;
case PROP_CONTEXT:
g_assert (self->context == NULL);
self->context = g_value_dup_object (value);
g_signal_connect_object (gcal_context_get_clock (self->context),
@@ -1758,8 +1759,6 @@ gcal_year_view_set_property (GObject *object,
self,
0);
update_weather (self);
g_object_notify (object, "context");
break;
case PROP_SHOW_WEEK_NUMBERS: