gnucash maint: Fix use-after-free in unable to save database dialog.
John Ralls
jralls at code.gnucash.org
Sat Apr 16 16:51:20 EDT 2022
Updated via https://github.com/Gnucash/gnucash/commit/b4587e43 (commit)
from https://github.com/Gnucash/gnucash/commit/de49a7e3 (commit)
commit b4587e432ffd7150639f5278b76cd77e98a487b0
Author: John Ralls <jralls at ceridwen.us>
Date: Sat Apr 16 13:51:10 2022 -0700
Fix use-after-free in unable to save database dialog.
diff --git a/gnucash/gnome-utils/gnc-main-window.c b/gnucash/gnome-utils/gnc-main-window.c
index a991bbcc9..a543b79aa 100644
--- a/gnucash/gnome-utils/gnc-main-window.c
+++ b/gnucash/gnome-utils/gnc-main-window.c
@@ -1261,6 +1261,7 @@ gnc_main_window_prompt_for_save (GtkWidget *window)
_("If you don't save, changes from the past %d days and %d hours will be discarded.");
time64 oldest_change;
gint minutes, hours, days;
+ guint timer_source = 0;
if (!gnc_current_session_exist())
return FALSE;
session = gnc_get_current_session();
@@ -1330,10 +1331,12 @@ gnc_main_window_prompt_for_save (GtkWidget *window)
g_object_set (G_OBJECT (label), "xalign", 0.0, NULL);
g_object_set_data (G_OBJECT (dialog), "count-down-label", label);
- g_timeout_add_seconds (1, (GSourceFunc)auto_save_countdown, dialog);
+ timer_source = g_timeout_add_seconds (1, (GSourceFunc)auto_save_countdown, dialog);
}
response = gtk_dialog_run (GTK_DIALOG (dialog));
+ if (timer_source)
+ g_source_remove (timer_source);
gtk_widget_destroy(dialog);
switch (response)
Summary of changes:
gnucash/gnome-utils/gnc-main-window.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
More information about the gnucash-changes
mailing list