Skip to content

Commit

Permalink
Windows: Use abort message instead of non-working terminate
Browse files Browse the repository at this point in the history
  • Loading branch information
hluk committed Sep 21, 2019
1 parent bcb3a7d commit 02e69ff
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/gui/mainwindow.cpp
Expand Up @@ -1454,7 +1454,7 @@ void MainWindow::terminateAction(int *actionId)

const int id = *actionId;
*actionId = -1;
m_actionHandler->terminateAction(id);
emit sendActionData(id, "ABORT");
}

bool MainWindow::isItemMenuDefaultActionValid() const
Expand Down
19 changes: 15 additions & 4 deletions src/scriptable/scriptable.cpp
Expand Up @@ -2434,7 +2434,12 @@ void Scriptable::runDisplayCommands()
QTimer timer;
timer.setSingleShot(true);
timer.setInterval(0);
connect(this, &Scriptable::dataReceived, &loop, [&]() {
connect(this, &Scriptable::dataReceived, &loop, [&](const QByteArray &receivedBytes) {
if (receivedBytes == "ABORT") {
abortEvaluation(Abort::AllEvaluations);
return;
}

timer.start();
});

Expand All @@ -2457,8 +2462,8 @@ void Scriptable::runDisplayCommands()

emit receiveData();

loop.exec();

if (m_abort == Abort::None)
loop.exec();
}

void Scriptable::runMenuCommandFilters()
Expand All @@ -2475,6 +2480,11 @@ void Scriptable::runMenuCommandFilters()
timer.setInterval(0);

connect(this, &Scriptable::dataReceived, &loop, [&](const QByteArray &receivedBytes) {
if (receivedBytes == "ABORT") {
abortEvaluation(Abort::AllEvaluations);
return;
}

bytes = receivedBytes;
if ( !bytes.isEmpty() )
timer.start();
Expand Down Expand Up @@ -2517,7 +2527,8 @@ void Scriptable::runMenuCommandFilters()

emit receiveData();

loop.exec();
if (m_abort == Abort::None)
loop.exec();
}

void Scriptable::monitorClipboard()
Expand Down

0 comments on commit 02e69ff

Please sign in to comment.