summaryrefslogtreecommitdiff
path: root/src/plugins/projectexplorer/appoutputpane.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/projectexplorer/appoutputpane.cpp')
-rw-r--r--src/plugins/projectexplorer/appoutputpane.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/plugins/projectexplorer/appoutputpane.cpp b/src/plugins/projectexplorer/appoutputpane.cpp
index e5caea75d1..33f9e6ccc6 100644
--- a/src/plugins/projectexplorer/appoutputpane.cpp
+++ b/src/plugins/projectexplorer/appoutputpane.cpp
@@ -427,7 +427,7 @@ bool AppOutputPane::closeTab(int index)
bool AppOutputPane::closeTab(int tabIndex, CloseTabMode closeTabMode)
{
- const int index = indexOf(m_tabWidget->widget(tabIndex));
+ int index = indexOf(m_tabWidget->widget(tabIndex));
QTC_ASSERT(index != -1, return true;)
RunControlTab &tab = m_runControlTabs[index];
@@ -441,13 +441,29 @@ bool AppOutputPane::closeTab(int tabIndex, CloseTabMode closeTabMode)
case CloseTabNoPrompt:
break;
case CloseTabWithPrompt:
+ QWidget *tabWidget = m_tabWidget->widget(tabIndex);
if (!tab.runControl->promptToStop())
return false;
+ // The event loop has run, thus the ordering might have changed, a tab might
+ // have been closed, so do some strange things...
+ tabIndex = m_tabWidget->indexOf(tabWidget);
+ index = indexOf(tabWidget);
+ if (tabIndex == -1 || index == -1)
+ return false;
+ tab = m_runControlTabs[index];
break;
}
- if (tab.runControl->stop() == RunControl::AsynchronousStop) {
- tab.asyncClosing = true;
- return false;
+ if (tab.runControl->isRunning()) { // yes it might have stopped already, then just close
+ QWidget *tabWidget = m_tabWidget->widget(tabIndex);
+ if (tab.runControl->stop() == RunControl::AsynchronousStop) {
+ tab.asyncClosing = true;
+ return false;
+ }
+ tabIndex = m_tabWidget->indexOf(tabWidget);
+ index = indexOf(tabWidget);
+ if (tabIndex == -1 || index == -1)
+ return false;
+ tab = m_runControlTabs[index];
}
}