mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
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:
@@ -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... */
|
||||
|
||||
Reference in New Issue
Block a user