Commit 72a5acc3 authored by Martin Tobias Holmedahl Sandsmark's avatar Martin Tobias Holmedahl Sandsmark Committed by Kurt Hindenburg
Browse files

Revert "Use RAII to manage QApplication memory"

This breaks the logic for the KDBusService crash fix. If this (using
unique_ptr) needs to be done it needs to carefully release() and reset()
at every step, and then it's just easier to manually delete it where
appropriate IMHO.

This reverts commit d5d8496c.

Differential Revision: https://phabricator.kde.org/D26764
parent 09cc4f6b
......@@ -32,7 +32,6 @@
#include <QProxyStyle>
#include <QStandardPaths>
#include <QDir>
#include <memory>
// KDE
#include <KAboutData>
......@@ -108,8 +107,7 @@ extern "C" int Q_DECL_EXPORT kdemain(int argc, char *argv[])
qputenv("QT_NO_GLIB", "1");
#endif
// Allocate QApplication on the heap for the KDBusService workaround
auto app = std::unique_ptr<QApplication>(new QApplication(argc, argv));
auto app = new QApplication(argc, argv);
app->setStyle(new MenuStyle());
#if defined(Q_OS_LINUX) && (QT_VERSION < QT_VERSION_CHECK(5, 11, 2))
......@@ -221,11 +219,15 @@ extern "C" int Q_DECL_EXPORT kdemain(int argc, char *argv[])
// 2. An invalid situation occurred
const bool continueStarting = (konsoleApp.newInstance() != 0);
if (!continueStarting) {
delete app;
return 0;
}
}
// Since we've allocated the QApplication on the heap for the KDBusService workaround,
// we need to delete it manually before returning from main().
int ret = app->exec();
delete app;
return ret;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment