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 d5d8496cd2.

Differential Revision: https://phabricator.kde.org/D26764
wilder-portage
Martin T. H. Sandsmark 6 years ago committed by Kurt Hindenburg
parent 09cc4f6bb9
commit 72a5acc335
  1. 8
      src/main.cpp

@ -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;
}

Loading…
Cancel
Save