mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #4649
anthony.bilinski (1): fix(exit): delete heap-based QApplication before exit
This commit is contained in:
commit
d974c60f0c
|
@ -148,14 +148,14 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
qInstallMessageHandler(logMessageHandler);
|
qInstallMessageHandler(logMessageHandler);
|
||||||
|
|
||||||
QApplication* a = new QApplication(argc, argv);
|
std::unique_ptr<QApplication> a(new QApplication(argc, argv));
|
||||||
|
|
||||||
#if defined(Q_OS_UNIX)
|
#if defined(Q_OS_UNIX)
|
||||||
// PosixSignalNotifier is used only for terminating signals,
|
// PosixSignalNotifier is used only for terminating signals,
|
||||||
// so it's connected directly to quit() without any filtering.
|
// so it's connected directly to quit() without any filtering.
|
||||||
QObject::connect(&PosixSignalNotifier::globalInstance(),
|
QObject::connect(&PosixSignalNotifier::globalInstance(),
|
||||||
&PosixSignalNotifier::activated,
|
&PosixSignalNotifier::activated,
|
||||||
a,
|
a.get(),
|
||||||
&QApplication::quit);
|
&QApplication::quit);
|
||||||
PosixSignalNotifier::watchCommonTerminatingSignals();
|
PosixSignalNotifier::watchCommonTerminatingSignals();
|
||||||
#endif
|
#endif
|
||||||
|
@ -326,7 +326,7 @@ int main(int argc, char* argv[])
|
||||||
else if (eventType == "save")
|
else if (eventType == "save")
|
||||||
handleToxSave(firstParam.toUtf8());
|
handleToxSave(firstParam.toUtf8());
|
||||||
|
|
||||||
QObject::connect(a, &QApplication::aboutToQuit, cleanup);
|
QObject::connect(a.get(), &QApplication::aboutToQuit, cleanup);
|
||||||
|
|
||||||
// Run (unless we already quit before starting!)
|
// Run (unless we already quit before starting!)
|
||||||
int errorcode = 0;
|
int errorcode = 0;
|
||||||
|
@ -334,6 +334,5 @@ int main(int argc, char* argv[])
|
||||||
errorcode = a->exec();
|
errorcode = a->exec();
|
||||||
|
|
||||||
qDebug() << "Exit with status" << errorcode;
|
qDebug() << "Exit with status" << errorcode;
|
||||||
delete a;
|
|
||||||
return errorcode;
|
return errorcode;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user