mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 796759 - --add-price-quotes <sql file> leaves a lock on the file.
First, save isn't necessary if the book is dirty, so don't... but that means that the book has to be marked dirty after a session swap. No more laziness. Second, regardless of the outcome of inner_main_add_price_quotes the session must be destroyed to remove the lock. A couple of cleanups in QofSessionImpl::save as well: Rewrote the descriptive comment to reflect how it really works when the backend has gotten disconnected and removed the superfluous qof_book_set_backend with the backend that we'd *just gotten from the book*.
This commit is contained in:
@@ -401,6 +401,7 @@ test_dbi_store_and_reload (Fixture* fixture, gconstpointer pData)
|
||||
g_assert (session_2 != NULL);
|
||||
g_assert_cmpint (qof_session_get_error (session_2), == , ERR_BACKEND_NO_ERR);
|
||||
qof_session_swap_data (fixture->session, session_2);
|
||||
qof_book_mark_session_dirty (qof_session_get_book (session_2));
|
||||
qof_session_save (session_2, NULL);
|
||||
g_assert (session_2 != NULL);
|
||||
g_assert_cmpint (qof_session_get_error (session_2), == , ERR_BACKEND_NO_ERR);
|
||||
@@ -459,6 +460,7 @@ test_dbi_safe_save (Fixture* fixture, gconstpointer pData)
|
||||
goto cleanup;
|
||||
}
|
||||
qof_session_swap_data (fixture->session, session_1);
|
||||
qof_book_mark_session_dirty (qof_session_get_book (session_1));
|
||||
qof_session_save (session_1, NULL);
|
||||
/* Do a safe save */
|
||||
qof_session_safe_save (session_1, NULL);
|
||||
@@ -532,6 +534,7 @@ test_dbi_version_control (Fixture* fixture, gconstpointer pData)
|
||||
goto cleanup;
|
||||
}
|
||||
qof_session_swap_data (fixture->session, sess);
|
||||
qof_book_mark_session_dirty (qof_session_get_book (sess));
|
||||
qof_session_save (sess, NULL);
|
||||
sql_be = reinterpret_cast<decltype(sql_be)>(qof_session_get_backend (sess));
|
||||
book = qof_session_get_book (sess);
|
||||
@@ -587,6 +590,7 @@ test_dbi_business_store_and_reload (Fixture* fixture, gconstpointer pData)
|
||||
session_2 = qof_session_new ();
|
||||
qof_session_begin (session_2, url, FALSE, TRUE, TRUE);
|
||||
qof_session_swap_data (fixture->session, session_2);
|
||||
qof_book_mark_session_dirty (qof_session_get_book (session_2));
|
||||
qof_session_save (session_2, NULL);
|
||||
|
||||
// Reload the session data
|
||||
|
||||
Reference in New Issue
Block a user