[gnome-calendar/fix-toast-crash] window: Fix crash in toast animation




commit 184d77ef4df561f595db7bc16f54a698f7d87c16
Author: Ray Strode <rstrode redhat com>
Date:   Fri Oct 14 13:38:03 2022 -0400

    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.

 src/gui/gcal-window.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/gui/gcal-window.c b/src/gui/gcal-window.c
index cb261c4c..a281b38a 100644
--- a/src/gui/gcal-window.c
+++ b/src/gui/gcal-window.c
@@ -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 */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]