Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
fix(main): register IPC handlers only after starting up
Browse files Browse the repository at this point in the history
  • Loading branch information
sudden6 committed Oct 31, 2018
1 parent a1a50b4 commit bc3d3b3
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand All @@ -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;
Expand Down

0 comments on commit bc3d3b3

Please sign in to comment.