forked from qt-creator/qt-creator
ApplicationOutputPane: Handle runControl being nullptr
The runControl associated with a tab might become nullptr. That was already handled in some places. Do so consistently now. Change-Id: I899cc467a213f2a991967fa98a5819a98412d387 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -321,7 +321,7 @@ void AppOutputPane::updateCloseActions()
|
|||||||
bool AppOutputPane::aboutToClose() const
|
bool AppOutputPane::aboutToClose() const
|
||||||
{
|
{
|
||||||
return Utils::allOf(m_runControlTabs, [](const RunControlTab &rt) {
|
return Utils::allOf(m_runControlTabs, [](const RunControlTab &rt) {
|
||||||
return !rt.runControl->isRunning() || rt.runControl->promptToStop();
|
return !rt.runControl || !rt.runControl->isRunning() || rt.runControl->promptToStop();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -507,9 +507,9 @@ void AppOutputPane::setBehaviorOnOutput(RunControl *rc, AppOutputPane::BehaviorO
|
|||||||
void AppOutputPane::reRunRunControl()
|
void AppOutputPane::reRunRunControl()
|
||||||
{
|
{
|
||||||
const int index = currentIndex();
|
const int index = currentIndex();
|
||||||
QTC_ASSERT(index != -1 && !m_runControlTabs.at(index).runControl->isRunning(), return);
|
const RunControlTab &tab = m_runControlTabs.at(index);
|
||||||
|
QTC_ASSERT(tab.runControl, return);
|
||||||
RunControlTab &tab = m_runControlTabs[index];
|
QTC_ASSERT(index != -1 && !tab.runControl->isRunning(), return);
|
||||||
|
|
||||||
handleOldOutput(tab.window);
|
handleOldOutput(tab.window);
|
||||||
tab.window->scrollToBottom();
|
tab.window->scrollToBottom();
|
||||||
@@ -521,7 +521,7 @@ void AppOutputPane::attachToRunControl()
|
|||||||
const int index = currentIndex();
|
const int index = currentIndex();
|
||||||
QTC_ASSERT(index != -1, return);
|
QTC_ASSERT(index != -1, return);
|
||||||
RunControl *rc = m_runControlTabs.at(index).runControl;
|
RunControl *rc = m_runControlTabs.at(index).runControl;
|
||||||
QTC_ASSERT(rc->isRunning(), return);
|
QTC_ASSERT(rc && rc->isRunning(), return);
|
||||||
ExtensionSystem::Invoker<void>(debuggerPlugin(), "attachExternalApplication", rc);
|
ExtensionSystem::Invoker<void>(debuggerPlugin(), "attachExternalApplication", rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -551,9 +551,10 @@ void AppOutputPane::closeTabs(CloseTabMode mode)
|
|||||||
|
|
||||||
QList<RunControl *> AppOutputPane::allRunControls() const
|
QList<RunControl *> AppOutputPane::allRunControls() const
|
||||||
{
|
{
|
||||||
return Utils::transform<QList>(m_runControlTabs,[](const RunControlTab &tab) {
|
const QList<RunControl *> list = Utils::transform<QList>(m_runControlTabs,[](const RunControlTab &tab) {
|
||||||
return tab.runControl.data();
|
return tab.runControl.data();
|
||||||
});
|
});
|
||||||
|
return Utils::filtered(list, [](RunControl *rc) { return rc; });
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppOutputPane::closeTab(int tabIndex, CloseTabMode closeTabMode)
|
void AppOutputPane::closeTab(int tabIndex, CloseTabMode closeTabMode)
|
||||||
@@ -568,7 +569,7 @@ void AppOutputPane::closeTab(int tabIndex, CloseTabMode closeTabMode)
|
|||||||
// Prompt user to stop
|
// Prompt user to stop
|
||||||
if (closeTabMode == CloseTabWithPrompt) {
|
if (closeTabMode == CloseTabWithPrompt) {
|
||||||
QWidget *tabWidget = m_tabWidget->widget(tabIndex);
|
QWidget *tabWidget = m_tabWidget->widget(tabIndex);
|
||||||
if (runControl->isRunning() && !runControl->promptToStop())
|
if (runControl && runControl->isRunning() && !runControl->promptToStop())
|
||||||
return;
|
return;
|
||||||
// The event loop has run, thus the ordering might have changed, a tab might
|
// The event loop has run, thus the ordering might have changed, a tab might
|
||||||
// have been closed, so do some strange things...
|
// have been closed, so do some strange things...
|
||||||
|
|||||||
Reference in New Issue
Block a user