Bug 726891 - segmentation fault on session.end()

Fill in the gnucash and gnucash-resave versions in an initial load so
that the version checks pass. Have python's Session.__init__() always
load the session so it's ready to handle other actions.
This commit is contained in:
John Ralls 2014-03-24 14:15:38 -07:00
parent 5dfd61091e
commit eaae6e9546
2 changed files with 8 additions and 3 deletions

View File

@ -52,6 +52,8 @@
#include "gnc-backend-dbi.h"
#include "gnc-prefs.h"
#ifdef S_SPLINT_S
#include "splint-defs.h"
#endif
@ -1409,7 +1411,11 @@ gnc_dbi_load( QofBackend* qbe, /*@ dependent @*/ QofBook *book, QofBackendLoadTy
be->primary_book = book;
// Set up table version information
gnc_sql_init_version_info( &be->sql_be );
gnc_sql_init_version_info (&be->sql_be);
gnc_sql_set_table_version (&be->sql_be, "Gnucash",
gnc_prefs_get_long_version());
gnc_sql_set_table_version (&be->sql_be, "Gnucash-Resave",
GNUCASH_RESAVE_VERSION);
// Call all object backends to create any required tables
qof_object_foreach_backend( GNC_SQL_BACKEND, create_tables_cb, be );

View File

@ -102,8 +102,7 @@ class Session(GnuCashCoreClass):
if book_uri is not None:
try:
self.begin(book_uri, ignore_lock, is_new, force_new)
if not is_new:
self.load()
self.load()
except GnuCashBackendException, backend_exception:
self.end()
self.destroy()