mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Decouple QofBook creation from QofSession.
So that we don't create two books when loading a session. Step 1 to not having a dirty book when we think we should have no book at all.
This commit is contained in:
@@ -224,4 +224,5 @@ char * no_args[1] = { NULL };
|
||||
gnc_engine_init(0, no_args);
|
||||
gnc_prefs_init();
|
||||
%}
|
||||
|
||||
//We must explicitly declare this or it gets left out and we can't create books.
|
||||
QofBook* qof_book_new (void);
|
||||
|
||||
@@ -103,7 +103,7 @@ class Session(GnuCashCoreClass):
|
||||
you don't need to cleanup and call end() and destroy(), that is handled
|
||||
for you, and the exception is raised.
|
||||
"""
|
||||
GnuCashCoreClass.__init__(self, instance=instance)
|
||||
GnuCashCoreClass.__init__(self, Book())
|
||||
if book_uri is not None:
|
||||
try:
|
||||
self.begin(book_uri, ignore_lock, is_new, force_new)
|
||||
|
||||
@@ -24,12 +24,15 @@
|
||||
int main()
|
||||
{
|
||||
const char* testurl = "sqlite3://" TESTFILE;
|
||||
char * no_args[1] = { NULL };
|
||||
QofSession* s = NULL;
|
||||
|
||||
qof_log_init();
|
||||
qof_init();
|
||||
char * no_args[1] = { NULL };
|
||||
gnc_engine_init(0, no_args);
|
||||
|
||||
QofSession * s = qof_session_new();
|
||||
s = qof_session_new(NULL);
|
||||
qof_session_begin(s, testurl, 0, 1, 0);
|
||||
qof_session_load(s, NULL);
|
||||
qof_session_save(s, NULL);
|
||||
|
||||
Reference in New Issue
Block a user