gui: main: Kill IPCServer process on exit

This commit is contained in:
Albert S. 2022-05-27 10:51:02 +02:00
förälder 0d6fb1d482
incheckning d66e395fda
1 ändrade filer med 5 tillägg och 2 borttagningar

Visa fil

@ -73,7 +73,10 @@ int main(int argc, char *argv[])
QProcess process;
QStringList args;
args << "ipc";
if(!process.startDetached("/proc/self/exe", args))
process.setProcessChannelMode(QProcess::ForwardedChannels);
process.start("/proc/self/exe", args);
if(!process.waitForStarted(5000))
{
QString errorMsg = "Failed to start IPC server";
qDebug() << errorMsg;
@ -108,9 +111,9 @@ int main(int argc, char *argv[])
QMessageBox::critical(nullptr, "Error", e.message);
return 1;
}
// Keep this post sandbox, afterwards does not work (suspect due to threads, but unconfirmed)
QApplication a(argc, argv);
a.setWindowIcon(QIcon(":/icon.svg"));
QObject::connect(&a, &QApplication::aboutToQuit, &process, &QProcess::kill);
qRegisterMetaType<QVector<SearchResult>>("QVector<SearchResult>");
qRegisterMetaType<QVector<PreviewResultPdf>>("QVector<PreviewResultPdf>");