AUDIT: r15975 - gnucash/trunk/src/gnome-utils - Suspend qof events for the interval between swapping the books between
David Hampton
hampton at cvs.gnucash.org
Sun Apr 22 01:22:53 EDT 2007
Author: hampton
Date: 2007-04-22 01:22:51 -0400 (Sun, 22 Apr 2007)
New Revision: 15975
Trac: http://svn.gnucash.org/trac/changeset/15975
Modified:
gnucash/trunk/src/gnome-utils/gnc-file.c
Log:
Suspend qof events for the interval between swapping the books between
two sessions, and installing the new session as the current session.
The books end up same before and after, but there is small interval in
the middle where any call to get the current book will get bogus
results. Fixes #414783.
BP
Modified: gnucash/trunk/src/gnome-utils/gnc-file.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-file.c 2007-04-22 00:49:31 UTC (rev 15974)
+++ gnucash/trunk/src/gnome-utils/gnc-file.c 2007-04-22 05:22:51 UTC (rev 15975)
@@ -1092,6 +1092,12 @@
return;
}
+ /* Prevent race condition between swapping the contents of the two
+ * sessions, and actually installing the new session as the current
+ * one. Any event callbacks that occur in this interval will have
+ * problems if they check for the current book. */
+ qof_event_suspend();
+
/* if we got to here, then we've successfully gotten a new session */
/* close up the old file session (if any) */
qof_session_swap_data (session, new_session);
@@ -1104,6 +1110,8 @@
*/
gnc_set_current_session(new_session);
+ qof_event_resume();
+
/* --------------- END CORE SESSION CODE -------------- */
/* oops ... file already exists ... ask user what to do... */
More information about the gnucash-changes
mailing list