forked from qt-creator/qt-creator
Fix crash on closing a tab of a asynchronously closing runcontrol
Task-number: QTCREATORBUG-6579 Change-Id: Ia1d629df24e1a4c7f4f830f575d1be4adc552409 Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
This commit is contained in:
@@ -427,7 +427,7 @@ bool AppOutputPane::closeTab(int index)
|
|||||||
|
|
||||||
bool AppOutputPane::closeTab(int tabIndex, CloseTabMode closeTabMode)
|
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;)
|
QTC_ASSERT(index != -1, return true;)
|
||||||
|
|
||||||
RunControlTab &tab = m_runControlTabs[index];
|
RunControlTab &tab = m_runControlTabs[index];
|
||||||
@@ -441,13 +441,29 @@ bool AppOutputPane::closeTab(int tabIndex, CloseTabMode closeTabMode)
|
|||||||
case CloseTabNoPrompt:
|
case CloseTabNoPrompt:
|
||||||
break;
|
break;
|
||||||
case CloseTabWithPrompt:
|
case CloseTabWithPrompt:
|
||||||
|
QWidget *tabWidget = m_tabWidget->widget(tabIndex);
|
||||||
if (!tab.runControl->promptToStop())
|
if (!tab.runControl->promptToStop())
|
||||||
return false;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
if (tab.runControl->stop() == RunControl::AsynchronousStop) {
|
if (tab.runControl->isRunning()) { // yes it might have stopped already, then just close
|
||||||
tab.asyncClosing = true;
|
QWidget *tabWidget = m_tabWidget->widget(tabIndex);
|
||||||
return false;
|
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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user