There are two scenarios when closing a window:
A) clicking the close button on the title bar (or Ctrl+Shift+Q):
~MainWindow()
~ViewManager()
~TabbedViewContainer()
~TerminalDisplay()
~Session()
B) closing the last session/tab in a window:
SessionController::sessionFinished()
~Session()
~TerminalDisplay()
~TabbedViewContainer()
~MainWindow()
~ViewManager()
the issue with the second case is that the TerminalDisplay is torn down
first, which exposes the TabbedViewContainer widget, the latter has the same
Qt::Window colour as the system colour scheme window background colour, if
you're using a dark terminal colour scheme and a light-coloured system colour
scheme, you could see some "flashing" when you close the last session with
e.g. Ctrl+D.
To fix this, in sessionFinished() check if TabbedViewContainer::count() is
1 (i.e. closing last tab/session), and emit the empty() signal in that case,
which is connected to MainwWindow::close(), then the order of tear down
becomes:
SessionController::sessionFinished()
~Session()
~MainWindow()
~ViewManager()
~TabbedViewContainer()
~TerminalDisplay()
BUG: 432077
FIXED-IN: 21.12
Looking at the crash backtraces from the bug reports, it seems this is what
happens, when you have two tabs open, then click the close button on the
non-current tab:
- QTabBar::currentChanged() is emitted, the TerminalDisplay pointer is
still not null at this point (the code checks for that)
- TabbedViewContainer::currentTabChanged()
- TabbedViewContainer::activeViewChanged()
- ViewManager::activateView(), at this point the TerminalDisplay pointer
could be null, which then crashes when we call Widget::setFocus()
BUG: 411962
FIXED-IN: 21.12
This is similar to commit c413d543c1, EditProfileDialog's base class
(KPageDialog) already connects OK button clicked signal to accepted() signal;
creating another connection to accepted() in SessionController (which
creates the EditProfileDialog object), means the code will be run twice, not
ideal. Instead put the logic in EditProfileDialog::save() which is called by
the EditProfileDialog::accept() slot.
The same goes when ProfileSettings creates an EditProfileDialog.
The very first time a user runs Konsole, where is no konsolerc file in $HOME,
there is no saved size to restore, instead use the sizeHint(), which ideally
will be the size set in the default profile (based on lines/columns setting).
CCBUG: 437791
Call setupGUI(), which will call createGUI (since we set the
KXmlGuiWindow::Create flag), omit the StatusBar flag since we don't have a
statusbar and don't want the "Show StatusBar" menu action.
TabbedViewContainer::sizeHint() calculates an optimum size for itself,
including the sizes of its child widgets; added in efb621d091 by
Mariusz Glebocki; following the code:
MainWindow creates a ViewManager
ViewManager creates a TabbedViewContainer and then a TerminalDisplay
which means that the first time TabbedViewContainer::sizeHint() is called
the TerminalDisplay widget size is 0, then TabbedViewContainer::sizeHint()
would return 0.
Which is why calling resize() in MainWindow was delayed to the showEvent(),
(and even delayed more by a QTimer::singleShot() call in Application),
at which point all the child widgets have been created and
MainWindow::sizeHint() (which logically takes into account the sizeHint()
of its child widgets) would return a sensible size.
CCBUG: 430036
CCBUG: 439339
BUG: 436471
Basically to use QWidget::windowHandle() to get a QWindow*, we need to first
set the Qt::WA_NativeWindow attribute on the QWidget. See:
https://phabricator.kde.org/D23108
BUG: 439871
FIXED-IN: 21.12
clearImage() just clears until _columns. To prevent characters from
beyond _columns from reappearing, e.g. due to DCH (Delete CHaracters)
requests, make clearImage() resize lines when clearing to the end of
line.
BUG: 432669
It is crashing several times a day for me, and every time it closes all
Konsole windows I have open (including the ones I'm working in), so I
suggest it should be turned off by default for this release.
(cherry picked from commit 2a788380f6)
_currentTerminalDisplay was not set until some interaction was made with
the TerminalDisplay widget. Set it as soon as Session->addView() is
called.
BUG: 439529
It is not unchecking the "Show SSH Manager" when closing the
dockWidget with the Close icon.
It is not checking the the box when the dockWidget opens with the
konsole.