diff options
author | Eike Ziller <eike.ziller@qt.io> | 2024-04-11 11:16:16 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2024-04-16 09:58:35 +0000 |
commit | cf7933a9808620cc7c07820a20bcf4d58464becd (patch) | |
tree | ff4018852dbcf4b0b3ab3db99deed261621cce8a /src/plugins/projectexplorer/appoutputpane.cpp | |
parent | fa29657881f6f4d0c7a7660cfdb5544a48baf768 (diff) |
iOS Simulator: Fix crash when starting app while another is running
Qt Creator would crash when starting an app in the Simulator while
another app is running, and the old app is not killed by the deployment
before run. This could happen in two cases:
1. Running an app in one simulator device and starting that or another
app on a different simulator device
2. Running an app in the simulator and starting that or another app on
the same device without deployment
In the first case, it actually doesn't make sense to stop the running
app, the Simulator can run multiple devices simultaneously (this might
have been different in the past).
In the second case, the new IosRunner initiated a stop of the old
RunConfig, and while that was in Stopping state, the app output window
tried to re-use the old tab and deleted the old RunConfig. This lead to
an assert in the RunConfigPrivate destructor, which only expects to be
deleted when in Initialized or Stopped state, and eventually to the
crash. The app output window should not reuse tabs that are not
"Stopped".
Fixes: QTCREATORBUG-30666
Change-Id: If46904dd487301e465e89ce7946be375ab4bdee8
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/appoutputpane.cpp')
-rw-r--r-- | src/plugins/projectexplorer/appoutputpane.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/plugins/projectexplorer/appoutputpane.cpp b/src/plugins/projectexplorer/appoutputpane.cpp index 898acaba2a..806628668f 100644 --- a/src/plugins/projectexplorer/appoutputpane.cpp +++ b/src/plugins/projectexplorer/appoutputpane.cpp @@ -391,14 +391,14 @@ void AppOutputPane::createNewOutputWindow(RunControl *rc) const CommandLine thisCommand = rc->commandLine(); const FilePath thisWorkingDirectory = rc->workingDirectory(); const Environment thisEnvironment = rc->environment(); - const auto tab = std::find_if(m_runControlTabs.begin(), m_runControlTabs.end(), - [&](const RunControlTab &tab) { - if (!tab.runControl || tab.runControl->isRunning() || tab.runControl->isStarting()) - return false; - return thisCommand == tab.runControl->commandLine() - && thisWorkingDirectory == tab.runControl->workingDirectory() - && thisEnvironment == tab.runControl->environment(); - }); + const auto tab = std::find_if( + m_runControlTabs.begin(), m_runControlTabs.end(), [&](const RunControlTab &tab) { + if (!tab.runControl || !tab.runControl->isStopped()) + return false; + return thisCommand == tab.runControl->commandLine() + && thisWorkingDirectory == tab.runControl->workingDirectory() + && thisEnvironment == tab.runControl->environment(); + }); if (tab != m_runControlTabs.end()) { // Reuse this tab if (tab->runControl) |