From 22af66e3b586583b2d8493b524accfc546cddf32 Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Fri, 8 Nov 2019 13:34:40 +0100 Subject: Ensure database contents are released right away. When we lock a database, we reset the database pointer to free its resources. Since various other widgets besides the DatabaseWidget hold references to the shared pointer object, however, it cannot be guaranteed that the actual database object will be freed right away. This patch adds a releaseData() method which is called upon database lock to ensure all residual data is cleared without having to rely on the actual database object being cleaned up. --- src/gui/DatabaseWidget.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gui/DatabaseWidget.cpp') diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index 54f2a2f47..29942571c 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -418,6 +418,8 @@ void DatabaseWidget::replaceDatabase(QSharedPointer db) // Keep the instance active till the end of this function Q_UNUSED(oldDb); #endif + + oldDb->releaseData(); } void DatabaseWidget::cloneEntry() -- cgit v1.2.3