diff --git a/plugins/gdb/unittests/test_gdb.cpp b/plugins/gdb/unittests/test_gdb.cpp --- a/plugins/gdb/unittests/test_gdb.cpp +++ b/plugins/gdb/unittests/test_gdb.cpp @@ -114,26 +114,23 @@ explicit TestLaunchConfiguration(const QUrl& executable = findExecutable(QStringLiteral("debuggee_debugee")), const QUrl& workingDirectory = QUrl()) { qDebug() << "FIND" << executable; - c = new KConfig(); + c = KSharedConfig::openConfig(); c->deleteGroup("launch"); cfg = c->group("launch"); cfg.writeEntry("isExecutable", true); cfg.writeEntry("Executable", executable); cfg.writeEntry("Working Directory", workingDirectory); } - ~TestLaunchConfiguration() override { - delete c; - } const KConfigGroup config() const override { return cfg; } KConfigGroup config() override { return cfg; }; QString name() const override { return QStringLiteral("Test-Launch"); } KDevelop::IProject* project() const override { return nullptr; } KDevelop::LaunchConfigurationType* type() const override { return nullptr; } - KConfig *rootConfig() { return c; } + KConfig* rootConfig() { return c.data(); } private: KConfigGroup cfg; - KConfig *c; + KSharedConfigPtr c; }; class TestFrameStackModel : public GdbFrameStackModel diff --git a/plugins/lldb/unittests/test_lldb.cpp b/plugins/lldb/unittests/test_lldb.cpp --- a/plugins/lldb/unittests/test_lldb.cpp +++ b/plugins/lldb/unittests/test_lldb.cpp @@ -99,26 +99,23 @@ explicit TestLaunchConfiguration(const QUrl& executable = findExecutable(QStringLiteral("debuggee_debugee")), const QUrl& workingDirectory = QUrl()) { qDebug() << "FIND" << executable; - c = new KConfig(); + c = KSharedConfig::openConfig(); c->deleteGroup("launch"); cfg = c->group("launch"); cfg.writeEntry("isExecutable", true); cfg.writeEntry("Executable", executable); cfg.writeEntry("Working Directory", workingDirectory); } - ~TestLaunchConfiguration() override { - delete c; - } const KConfigGroup config() const override { return cfg; } KConfigGroup config() override { return cfg; }; QString name() const override { return QStringLiteral("Test-Launch"); } KDevelop::IProject* project() const override { return nullptr; } KDevelop::LaunchConfigurationType* type() const override { return nullptr; } - KConfig *rootConfig() { return c; } + KConfig* rootConfig() { return c.data(); } private: KConfigGroup cfg; - KConfig *c; + KSharedConfigPtr c; }; class TestFrameStackModel : public LldbFrameStackModel diff --git a/plugins/lldb/unittests/test_lldbformatters.cpp b/plugins/lldb/unittests/test_lldbformatters.cpp --- a/plugins/lldb/unittests/test_lldbformatters.cpp +++ b/plugins/lldb/unittests/test_lldbformatters.cpp @@ -94,26 +94,22 @@ const QUrl& workingDirectory = QUrl()) { auto execPath = findExecutable(executable); qDebug() << "FIND" << execPath; - c = new KConfig(); + c = KSharedConfig::openConfig(); c->deleteGroup("launch"); cfg = c->group("launch"); cfg.writeEntry("isExecutable", true); cfg.writeEntry("Executable", execPath); cfg.writeEntry("Working Directory", workingDirectory); } - ~TestLaunchConfiguration() override { - delete c; - } const KConfigGroup config() const override { return cfg; } KConfigGroup config() override { return cfg; }; QString name() const override { return QStringLiteral("Test-Launch"); } KDevelop::IProject* project() const override { return nullptr; } KDevelop::LaunchConfigurationType* type() const override { return nullptr; } - KConfig *rootConfig() { return c; } private: KConfigGroup cfg; - KConfig *c; + KSharedConfigPtr c; }; class TestDebugSession : public DebugSession