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