window: Fix crash in toast animation

Every once in a while when I'm deleting an event gnome-calendar crashes.

I dug in a bit, and it seems the reason is
adw_toast_overlay_add_toast takes ownership of the passed in reference.

This is a little idiosyncratic for something that's not GInitiallyUnowned,
but it appears to be the API nonetheless.

GCalWindow assumes it owns the reference.

This commit makes both users of the toast happy by adding a ref call.
This commit is contained in:
Ray Strode
2022-10-14 13:38:03 -04:00
parent 92c14f8bea
commit 184d77ef4d
+1 -1
View File
@@ -706,7 +706,7 @@ on_event_editor_dialog_remove_event_cb (GcalEventEditorDialog *edit_dialog,
g_object_set_data (G_OBJECT (toast), "modifier", GINT_TO_POINTER (modifier));
g_signal_connect (toast, "dismissed", G_CALLBACK (on_toast_dismissed_cb), self);
adw_toast_overlay_add_toast (self->overlay, toast);
adw_toast_overlay_add_toast (self->overlay, g_object_ref (toast));
self->delete_event_toast = g_steal_pointer (&toast);
/* hide widget of the event */