Commit 1946d32d authored by Martin Tobias Holmedahl Sandsmark's avatar Martin Tobias Holmedahl Sandsmark Committed by Tomaz Canabrava
Browse files

Fix one crash in the sshmanager plugin

BUG: 439551
parent 54186903
......@@ -11,6 +11,7 @@
#include "sshmanagermodel.h"
#include "session/SessionController.h"
#include "konsoledebug.h"
#include <QMainWindow>
#include <QDockWidget>
......@@ -78,12 +79,29 @@ QList<QAction *> SSHManagerPlugin::menuBarActions(Konsole::MainWindow* mainWindo
void SSHManagerPlugin::activeViewChanged(Konsole::SessionController *controller)
void SSHManagerPlugin::activeViewChangedInternal(QPointer<Konsole::SessionController> controller)
if (!controller) {
qCWarning(KonsoleDebug) << "Active view changed, but no controller";
if (!controller->view()) {
qCWarning(KonsoleDebug) << controller << "does not have a view";
auto mainWindow = qobject_cast<Konsole::MainWindow*>(controller->view()->topLevelWidget());
// if we don't get a mainwindow here this *might* be just opening, call it again
// HACK: if we don't get a mainwindow here this *might* be just opening, call it again
// later on.
// We really shouldn't use an arbitrary time delay, and we need to use a
// QPointer in case it gets deleted while the timer is running.
if (!mainWindow) {
QTimer::singleShot(500, this, [this, controller]{ activeViewChanged(controller); });
QTimer::singleShot(500, this, [this, controller]{ activeViewChangedInternal(controller); });
......@@ -29,6 +29,9 @@ public:
void activeViewChanged(Konsole::SessionController *controller) override;
QList<QAction*> menuBarActions(Konsole::MainWindow* mainWindow) const override;
private Q_SLOTS:
void activeViewChangedInternal(QPointer<Konsole::SessionController> controller);
std::unique_ptr<SSHManagerPluginPrivate> d;
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