From df299589d46a55f8ca7083b79fcb09fb34b384dc Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Tue, 29 Oct 2013 19:25:52 +0000 Subject: [PATCH] On file open, only destroy a previous session if really exists git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@23349 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/gnome-utils/gnc-file.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/gnome-utils/gnc-file.c b/src/gnome-utils/gnc-file.c index 0e5a36da4b..8b388f09df 100644 --- a/src/gnome-utils/gnc-file.c +++ b/src/gnome-utils/gnc-file.c @@ -701,11 +701,14 @@ RESTART: /* -------------- BEGIN CORE SESSION CODE ------------- */ /* -- this code is almost identical in FileOpen and FileSaveAs -- */ - current_session = gnc_get_current_session(); - qof_session_call_close_hooks(current_session); - gnc_hook_run(HOOK_BOOK_CLOSED, current_session); - gnc_close_gui_component_by_session (current_session); - gnc_clear_current_session(); + if (gnc_current_session_exist()) + { + current_session = gnc_get_current_session(); + qof_session_call_close_hooks(current_session); + gnc_hook_run(HOOK_BOOK_CLOSED, current_session); + gnc_close_gui_component_by_session (current_session); + gnc_clear_current_session(); + } /* load the accounts from the users datafile */ /* but first, check to make sure we've got a session going. */