Bug 797906 - GnuCash data file is locked after a "save-as"...

to mysql database.

It's more general, any save-as to a different backend type, i.e.
xml->sql or sql->xml, left the previous book locked.

Ensure that the session is ended and the book unlocked in the
backend's destructor. This also fixes a memory leak in the SQL
backend because the GncSqlConnection wasn't being deleted.
This commit is contained in:
John Ralls
2021-03-23 09:48:19 -07:00
parent 0c15dc175c
commit 170502c6c5
5 changed files with 14 additions and 5 deletions

View File

@@ -49,6 +49,11 @@ extern "C"
#define FILE_URI_PREFIX "file://"
static QofLogModule log_module = GNC_MOD_BACKEND;
GncXmlBackend::~GncXmlBackend()
{
session_end();
};
bool
GncXmlBackend::check_path (const char* fullpath, bool create)
{

View File

@@ -34,7 +34,7 @@ public:
GncXmlBackend operator=(const GncXmlBackend&) = delete;
GncXmlBackend(const GncXmlBackend&&) = delete;
GncXmlBackend operator=(const GncXmlBackend&&) = delete;
~GncXmlBackend() = default;
~GncXmlBackend();
void session_begin(QofSession* session, const char* new_uri,
SessionOpenMode mode) override;
void session_end() override;