Skip to content

Commit df1fa27

Browse files
authored
Fix nasty and still unclear bug with "Close Other" not closing all tabs in certain conditions. (#725)
1 parent 936eba0 commit df1fa27

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

src/DockAreaTabBar.cpp

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -334,27 +334,13 @@ void CDockAreaTabBar::onTabCloseRequested()
334334
void CDockAreaTabBar::onCloseOtherTabsRequested()
335335
{
336336
auto Sender = qobject_cast<CDockWidgetTab*>(sender());
337-
for (int i = 0; i < count(); ++i)
338-
{
339-
auto Tab = tab(i);
340-
if (Tab->isClosable() && !Tab->isHidden() && Tab != Sender)
341-
{
342-
// If the dock widget is deleted with the closeTab() call, its tab
343-
// it will no longer be in the layout, and thus the index needs to
344-
// be updated to not skip any tabs
345-
int Offset = Tab->dockWidget()->features().testFlag(
346-
CDockWidget::DockWidgetDeleteOnClose) ? 1 : 0;
347-
closeTab(i);
348-
349-
// If the dock widget blocks closing, i.e. if the flag
350-
// CustomCloseHandling is set, and the dock widget is still open,
351-
// then we do not need to correct the index
352-
if (Tab->dockWidget()->isClosed())
353-
{
354-
i -= Offset;
355-
}
356-
}
357-
}
337+
338+
for (int i = count() - 1; i >= 0; --i) {
339+
auto Tab = tab(i);
340+
if (Tab->isClosable() && !Tab->isHidden() && Tab != Sender) {
341+
closeTab(i);
342+
}
343+
}
358344
}
359345

360346

0 commit comments

Comments
 (0)