Fixes crash when using the Copy Input To All Tabs feature
Summary:
Fixes crash when using the Copy Input To All Tabs feature. The crash is
caused because the sessions are removed from the SessionManager before
the MainWindow is updated. When the MainWindow receives the
activeViewChanged signal it assumes that the
SessionManager::sessionProfile returns a valid Profile pointer, but in
this case it has already been freed and is therefore nullptr. The fix is
to simply check if the new active Session has a valid Profile, if not
simply ignore it.
Test Plan:
- Open Konsole window
- Open multiple tabs within that Konsole window
- (apparently an important piece) Scroll through the tabs and go back to the first one opened, on the far left of the tab bar
- Select Edit menu -> Copy Input To -> All Tabs in Current Window
- Type a ctrl-D to issue logout command to all tabs in window
BUG: 405158
Reviewers: Konsole, hindenburg
Reviewed By: Konsole, hindenburg
Subscribers: hindenburg, konsole-devel
Tags: Konsole
Differential Revision: https://phabricator.kde.org/D19642