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:
+12
-13
@@ -868,15 +868,15 @@ gcal_window_constructed (GObject *object)
|
||||
* FIXME: this is a hack around the issue that happens when trying to bind
|
||||
* these properties using the GtkBuilder .ui file.
|
||||
*/
|
||||
g_object_bind_property (self, "context", self->calendar_popover, "context", G_BINDING_DEFAULT);
|
||||
g_object_bind_property (self, "context", self->calendar_popover, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
|
||||
g_object_bind_property (self, "context", self->weather_settings, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
|
||||
g_object_bind_property (self, "context", self->calendar_management_dialog, "context", G_BINDING_DEFAULT);
|
||||
g_object_bind_property (self, "context", self->calendar_management_dialog, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
|
||||
g_object_bind_property (self, "context", self->week_view, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
|
||||
g_object_bind_property (self, "context", self->month_view, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
|
||||
g_object_bind_property (self, "context", self->year_view, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
|
||||
g_object_bind_property (self, "context", self->edit_dialog, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
|
||||
g_object_bind_property (self, "context", self->quick_add_popover, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
|
||||
g_object_bind_property (self, "context", self->search_button, "context", G_BINDING_DEFAULT);
|
||||
g_object_bind_property (self, "context", self->search_button, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
|
||||
|
||||
GCAL_EXIT;
|
||||
}
|
||||
@@ -908,16 +908,15 @@ gcal_window_set_property (GObject *object,
|
||||
break;
|
||||
|
||||
case PROP_CONTEXT:
|
||||
if (g_set_object (&self->context, g_value_get_object (value)))
|
||||
{
|
||||
g_settings_bind (gcal_context_get_settings (self->context),
|
||||
"active-view",
|
||||
self,
|
||||
"active-view",
|
||||
G_SETTINGS_BIND_SET | G_SETTINGS_BIND_GET);
|
||||
g_assert (self->context == NULL);
|
||||
self->context = g_value_dup_object (value);
|
||||
|
||||
g_settings_bind (gcal_context_get_settings (self->context),
|
||||
"active-view",
|
||||
self,
|
||||
"active-view",
|
||||
G_SETTINGS_BIND_SET | G_SETTINGS_BIND_GET);
|
||||
|
||||
g_object_notify_by_pspec (object, properties[PROP_CONTEXT]);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1024,7 +1023,7 @@ gcal_window_class_init (GcalWindowClass *klass)
|
||||
"Context",
|
||||
"Context",
|
||||
GCAL_TYPE_CONTEXT,
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
properties[PROP_NEW_EVENT_MODE] = g_param_spec_boolean ("new-event-mode",
|
||||
"New Event mode",
|
||||
|
||||
Reference in New Issue
Block a user