[Gnucash-changes] r13809 - gnucash/trunk - Don't call shutdown
directly from the delete_event handler, but use a
David Hampton
hampton at cvs.gnucash.org
Wed Apr 19 18:28:04 EDT 2006
Author: hampton
Date: 2006-04-19 18:28:04 -0400 (Wed, 19 Apr 2006)
New Revision: 13809
Trac: http://svn.gnucash.org/trac/changeset/13809
Modified:
gnucash/trunk/ChangeLog
gnucash/trunk/src/gnome-utils/gnc-main-window.c
Log:
Don't call shutdown directly from the delete_event handler, but use a
periodic idle function that checks to insure that gnucash isn't saving
the data file before calling shutdown. Fixes 338952.
Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog 2006-04-19 19:35:33 UTC (rev 13808)
+++ gnucash/trunk/ChangeLog 2006-04-19 22:28:04 UTC (rev 13809)
@@ -1,3 +1,11 @@
+2006-04-19 David Hampton <hampton at employees.org>
+
+ * src/gnome-utils/gnc-main-window.c: Don't call shutdown directly
+ from the delete_event handler, but use a periodic idle function
+ that checks to insure that gnucash isn't saving the data file
+ before calling shutdown. Fixes 338952. Also ignore repeated
+ delete events if a shutdown is queued.
+
2006-04-19 Christian Stimming <stimming at tuhh.de>
* accounts/fr_CH/acctchrt_*.gnucash-xea: New French Swiss account
Modified: gnucash/trunk/src/gnome-utils/gnc-main-window.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-main-window.c 2006-04-19 19:35:33 UTC (rev 13808)
+++ gnucash/trunk/src/gnome-utils/gnc-main-window.c 2006-04-19 22:28:04 UTC (rev 13809)
@@ -992,10 +992,21 @@
static gboolean
+gnc_main_window_timed_quit (gpointer dummy)
+{
+ if (gnc_file_save_in_progress())
+ return TRUE;
+
+ gnc_shutdown (0);
+ return FALSE;
+}
+
+static gboolean
gnc_main_window_delete_event (GtkWidget *window,
GdkEvent *event,
gpointer user_data)
{
+ static gboolean already_dead = FALSE;
QofSession *session;
GtkWidget *dialog;
gint response;
@@ -1005,6 +1016,9 @@
"application. Are you sure that this is "
"what you want to do?");
+ if (already_dead)
+ return TRUE;
+
if (!gnc_main_window_finish_pending(GNC_MAIN_WINDOW(window))) {
/* Don't close the window. */
return TRUE;
@@ -1017,7 +1031,8 @@
if (qof_book_not_saved(qof_session_get_book(session))) {
if (!gnc_main_window_prompt_for_save(GTK_WIDGET(window))) {
/* Tell gnucash to shutdown cleanly */
- g_idle_add((GSourceFunc)gnc_shutdown, 0);
+ g_timeout_add(250, gnc_main_window_timed_quit, NULL);
+ already_dead = TRUE;
}
/* Cancel the window deletion. It'll happen on the just queued shutdown. */
return TRUE;
@@ -1040,7 +1055,8 @@
if (response == GTK_RESPONSE_OK) {
/* Tell gnucash to shutdown cleanly */
- g_idle_add((GSourceFunc)gnc_shutdown, 0);
+ g_timeout_add(250, gnc_main_window_timed_quit, NULL);
+ already_dead = TRUE;
}
return TRUE;
}
@@ -2844,16 +2860,6 @@
gnc_main_window_close_page(page);
}
-static gboolean
-gnc_main_window_timed_quit (gpointer dummy)
-{
- if (gnc_file_save_in_progress())
- return TRUE;
-
- gnc_shutdown (0);
- return FALSE;
-}
-
static void
gnc_main_window_cmd_file_quit (GtkAction *action, GncMainWindow *window)
{
More information about the gnucash-changes
mailing list