gcal-window: Event deletion aborts unfinished previous delete attempt

Cannot use g_clear_pointer() here, because it unsets the pointer first and
only then calls the free function, which means the test on self->delete_event_toast
NULL-ness would be satisfied in the on_toast_dismissed_cb(), thus the previous
event delete attempt would be "cancelled" internally.

Closes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/858
This commit is contained in:
Milan Crha
2022-10-05 18:44:25 +02:00
parent 5e72aa53f2
commit 8138619419
+3 -1
View File
@@ -694,7 +694,9 @@ on_event_editor_dialog_remove_event_cb (GcalEventEditorDialog *edit_dialog,
GCAL_ENTRY;
has_deleted_event = self->delete_event_toast != NULL;
g_clear_pointer (&self->delete_event_toast, adw_toast_dismiss);
if (self->delete_event_toast)
adw_toast_dismiss (self->delete_event_toast);
self->delete_event_toast = NULL;
toast = adw_toast_new (has_deleted_event ? _("Another event deleted") : _("Event deleted"));
adw_toast_set_timeout (toast, 5);