r16083 - gnucash/branches/2.0 - Suspend qof events for the interval between swapping the books between

Derek Atkins warlord at cvs.gnucash.org
Mon May 14 10:38:06 EDT 2007


Author: warlord
Date: 2007-05-14 10:38:04 -0400 (Mon, 14 May 2007)
New Revision: 16083
Trac: http://svn.gnucash.org/trac/changeset/16083

Modified:
   gnucash/branches/2.0/
   gnucash/branches/2.0/ChangeLog
   gnucash/branches/2.0/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.

Merge from r15975



Property changes on: gnucash/branches/2.0
___________________________________________________________________
Name: svk:merge
   - 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/2.0:697
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/2.0:14599
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13282
   + 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/2.0:697
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/2.0:14722
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13282

Modified: gnucash/branches/2.0/ChangeLog
===================================================================
--- gnucash/branches/2.0/ChangeLog	2007-05-13 20:54:57 UTC (rev 16082)
+++ gnucash/branches/2.0/ChangeLog	2007-05-14 14:38:04 UTC (rev 16083)
@@ -1,3 +1,11 @@
+2007-05-13  David Hampton  <hampton at employees.org>
+
+	* 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.
+
 2007-04-21  David Hampton  <hampton at employees.org>
 
 	* Disable the close callback while updating reports.  Fixes #416986.

Modified: gnucash/branches/2.0/src/gnome-utils/gnc-file.c
===================================================================
--- gnucash/branches/2.0/src/gnome-utils/gnc-file.c	2007-05-13 20:54:57 UTC (rev 16082)
+++ gnucash/branches/2.0/src/gnome-utils/gnc-file.c	2007-05-14 14:38:04 UTC (rev 16083)
@@ -1099,6 +1099,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);
@@ -1111,6 +1117,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