From cb1c9f5e83e98039d38f548c80d4b95442163cf2 Mon Sep 17 00:00:00 2001 From: Eran Mizrahi Date: Tue, 19 Dec 2017 00:44:18 +0200 Subject: Tie moshortcuts to a specific instance --- src/organizercore.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/organizercore.cpp') diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 3be9559a..7668485c 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -32,6 +32,7 @@ #include #include #include "lockeddialog.h" +#include "instancemanager.h" #include #include @@ -578,8 +579,8 @@ void OrganizerCore::downloadRequestedNXM(const QString &url) void OrganizerCore::externalMessage(const QString &message) { - if (isMoShortcut(message)) { - runShortcut(moShortcutName(message)); + if (MOShortcut moshortcut{ message }) { + runShortcut(moshortcut); } else if (isNxmLink(message)) { MessageDialog::showMessage(tr("Download started"), qApp->activeWindow()); @@ -1228,9 +1229,15 @@ HANDLE OrganizerCore::spawnBinaryProcess(const QFileInfo &binary, } } -HANDLE OrganizerCore::runShortcut(const QString &title) +HANDLE OrganizerCore::runShortcut(const MOShortcut& shortcut) { - Executable& exe = m_ExecutablesList.find(title); + if (shortcut.hasInstance() && shortcut.instance() != InstanceManager::instance().currentInstance()) + throw std::runtime_error( + QString("Refusing to run executable from different instance %1:%2") + .arg(shortcut.instance(),shortcut.executable()) + .toLocal8Bit().constData()); + + Executable& exe = m_ExecutablesList.find(shortcut.executable()); return spawnBinaryDirect( exe.m_BinaryInfo, exe.m_Arguments, -- cgit v1.3.1