summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2022-10-05 18:23:28 +0200
committerMilan Crha <mcrha@redhat.com>2022-10-05 18:44:25 +0200
commit81386194194f5b033d7616a73d9643a21e3afc39 (patch)
tree412d42092c50d7f2230c8fc0576bb83086af23d2
parent5e72aa53f2dd2ba3f89b416e70dd35a968ce1c67 (diff)
downloadgnome-calendar-81386194194f5b033d7616a73d9643a21e3afc39.tar.gz
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
-rw-r--r--src/gui/gcal-window.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/gcal-window.c b/src/gui/gcal-window.c
index 96afef5a..cb261c4c 100644
--- a/src/gui/gcal-window.c
+++ b/src/gui/gcal-window.c
@@ -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);