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;
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user