Fix use-after-free in unable to save database dialog.

This commit is contained in:
John Ralls 2022-04-16 13:51:10 -07:00
parent de49a7e370
commit b4587e432f

View File

@ -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)