aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/terminalinterface.cpp
diff options
context:
space:
mode:
authorMarcus Tillmanns <[email protected]>2023-11-06 13:49:21 +0100
committerMarcus Tillmanns <[email protected]>2023-11-07 08:53:31 +0000
commitdce08c5b9e304c44d040190a4d8f9bfa17287c44 (patch)
tree5008503a39f2e04ce65919f2df9b2a8a7b1d38a4 /src/libs/utils/terminalinterface.cpp
parent05ce5ea14df56c0394ba78679a581b9a40bec5cf (diff)
Utils: Fix crash if stub fails to start
If the inferior did not start the TerminalInterface did not send an error up the chain, which meant that the runcontrol does not exit. This would lead to a crash. Change-Id: Icf9f8f913d84a9ed6414e15ce3a3587b1580425e Reviewed-by: Christian Stenger <[email protected]>
Diffstat (limited to 'src/libs/utils/terminalinterface.cpp')
-rw-r--r--src/libs/utils/terminalinterface.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libs/utils/terminalinterface.cpp b/src/libs/utils/terminalinterface.cpp
index 9fb226ece54..3cd1e5bb21d 100644
--- a/src/libs/utils/terminalinterface.cpp
+++ b/src/libs/utils/terminalinterface.cpp
@@ -92,6 +92,7 @@ public:
StubCreator *stubCreator{nullptr};
const bool waitOnExit;
+ bool didInferiorRun{false};
};
TerminalInterface::TerminalInterface(bool waitOnExit)
@@ -156,6 +157,11 @@ void TerminalInterface::onStubExited()
if (d->inferiorProcessId)
emitFinished(-1, QProcess::CrashExit);
+ else if (!d->didInferiorRun) {
+ emitError(QProcess::FailedToStart,
+ Tr::tr("Failed to start terminal process. The stub exited before the inferior "
+ "was started."));
+ }
}
void TerminalInterface::onStubReadyRead()
@@ -176,6 +182,7 @@ void TerminalInterface::onStubReadyRead()
d->envListFile = nullptr;
} else if (out.startsWith("pid ")) {
d->inferiorProcessId = out.mid(4).toInt();
+ d->didInferiorRun = true;
emit started(d->inferiorProcessId, d->inferiorThreadId);
} else if (out.startsWith("thread ")) { // Windows only
d->inferiorThreadId = out.mid(7).toLongLong();