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


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15975 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton
2007-04-22 05:22:51 +00:00
parent 319f22bf81
commit c0dd45b5d2

View File

@@ -1092,6 +1092,12 @@ gnc_file_save_as (void)
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_file_save_as (void)
*/
gnc_set_current_session(new_session);
qof_event_resume();
/* --------------- END CORE SESSION CODE -------------- */
/* oops ... file already exists ... ask user what to do... */