1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix(main): register IPC handlers only after starting up

This commit is contained in:
sudden6 2018-10-31 01:46:33 +01:00
parent a1a50b4bed
commit bc3d3b3b13
No known key found for this signature in database
GPG Key ID: 279509B499E032B9

View File

@ -279,10 +279,6 @@ int main(int argc, char* argv[])
QString profileName;
bool autoLogin = Settings::getInstance().getAutoLogin();
// Inter-process communication
ipc.registerEventHandler("uri", &toxURIEventHandler);
ipc.registerEventHandler("save", &toxSaveEventHandler);
ipc.registerEventHandler("activate", &toxActivateEventHandler);
uint32_t ipcDest = 0;
bool doIpc = true;
@ -362,6 +358,11 @@ int main(int argc, char* argv[])
Nexus& nexus = Nexus::getInstance();
nexus.start();
// Start to accept Inter-process communication
ipc.registerEventHandler("uri", &toxURIEventHandler);
ipc.registerEventHandler("save", &toxSaveEventHandler);
ipc.registerEventHandler("activate", &toxActivateEventHandler);
// Event was not handled by already running instance therefore we handle it ourselves
if (eventType == "uri")
handleToxURI(firstParam.toUtf8());
@ -370,10 +371,8 @@ int main(int argc, char* argv[])
QObject::connect(a.get(), &QApplication::aboutToQuit, cleanup);
// Run (unless we already quit before starting!)
int errorcode = 0;
if (nexus.isRunning())
errorcode = a->exec();
// Run
int errorcode = a->exec();
qDebug() << "Exit with status" << errorcode;
return errorcode;