Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan White <support@dmapps.us>2020-06-20 01:25:59 +0300
committerJonathan White <support@dmapps.us>2020-06-20 04:24:43 +0300
commit736df7696fc3e995b3dbc8a7f0338f7c31b6dde4 (patch)
tree433b04dc1e527d5c2a471573d8f18fb85043bfed
parentc46f3d37b1e8413ff8b97eccf314ec9e098f0acc (diff)
FDO Secrets: Fix double free on exit
* Prevent double free due to QObject cleanup happening before/after the ExtraPage storing the QSharedPointer to FdoSecretsPlugin is deleted. * Fixes #4877
-rw-r--r--src/fdosecrets/FdoSecretsPlugin.cpp12
-rw-r--r--src/fdosecrets/FdoSecretsPlugin.h3
-rw-r--r--tests/gui/TestGuiFdoSecrets.cpp2
3 files changed, 14 insertions, 3 deletions
diff --git a/src/fdosecrets/FdoSecretsPlugin.cpp b/src/fdosecrets/FdoSecretsPlugin.cpp
index 9db35338d..96d76e345 100644
--- a/src/fdosecrets/FdoSecretsPlugin.cpp
+++ b/src/fdosecrets/FdoSecretsPlugin.cpp
@@ -30,13 +30,21 @@
using FdoSecrets::Service;
+// TODO: Only used for testing. Need to split service functions away from settings page.
+QPointer<FdoSecretsPlugin> g_fdoSecretsPlugin;
+
FdoSecretsPlugin::FdoSecretsPlugin(DatabaseTabWidget* tabWidget)
- : QObject(tabWidget)
- , m_dbTabs(tabWidget)
+ : m_dbTabs(tabWidget)
{
+ g_fdoSecretsPlugin = this;
FdoSecrets::registerDBusTypes();
}
+FdoSecretsPlugin* FdoSecretsPlugin::getPlugin()
+{
+ return g_fdoSecretsPlugin;
+}
+
QWidget* FdoSecretsPlugin::createWidget()
{
return new SettingsWidgetFdoSecrets(this);
diff --git a/src/fdosecrets/FdoSecretsPlugin.h b/src/fdosecrets/FdoSecretsPlugin.h
index 674c3c3b8..d0008b80a 100644
--- a/src/fdosecrets/FdoSecretsPlugin.h
+++ b/src/fdosecrets/FdoSecretsPlugin.h
@@ -70,6 +70,9 @@ public:
*/
QString reportExistingService() const;
+ // TODO: Only used for testing. Need to split service functions away from settings page.
+ static FdoSecretsPlugin* getPlugin();
+
public slots:
void emitRequestSwitchToDatabases();
void emitRequestShowNotification(const QString& msg, const QString& title = {});
diff --git a/tests/gui/TestGuiFdoSecrets.cpp b/tests/gui/TestGuiFdoSecrets.cpp
index deccc26d3..9dffa6ba5 100644
--- a/tests/gui/TestGuiFdoSecrets.cpp
+++ b/tests/gui/TestGuiFdoSecrets.cpp
@@ -200,7 +200,7 @@ void TestGuiFdoSecrets::initTestCase()
m_mainWindow.reset(new MainWindow());
m_tabWidget = m_mainWindow->findChild<DatabaseTabWidget*>("tabWidget");
QVERIFY(m_tabWidget);
- m_plugin = m_mainWindow->findChild<FdoSecretsPlugin*>();
+ m_plugin = FdoSecretsPlugin::getPlugin();
QVERIFY(m_plugin);
m_mainWindow->show();