Commit aa6193b0 authored by Nathan Sprangers's avatar Nathan Sprangers Committed by Tomaz Canabrava
Browse files

Disable "detach-tab" after closing others

Other signals are received too early when closing tabs.
ViewContainer::viewRemoved is received after the tab count has been

Protect against the "detach-tab" action when only one left.

Fixes the following behavior:
 - Create two tabs
 - Close one tab
 - Detach the remaining tab through menu or shortcut
 - The original window is blank - no terminal display. Adding a tab
   to it crashes
parent d37d3ac1
......@@ -295,6 +295,8 @@ void ViewManager::setupActions()
connect(_viewContainer, &TabbedViewContainer::viewAdded, this, &ViewManager::toggleActionsBasedOnState);
connect(_viewContainer, &QTabWidget::currentChanged, this, &ViewManager::toggleActionsBasedOnState);
// Let the view container remove the view before counting tabs
connect(_viewContainer, &TabbedViewContainer::viewRemoved, this, &ViewManager::toggleActionsBasedOnState);
......@@ -445,6 +447,9 @@ void ViewManager::detachActiveView()
void ViewManager::detachActiveTab()
if (_viewContainer->count() < 2) {
const int currentIdx = _viewContainer->currentIndex();
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment