X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/38342ae820a434a547575299b02a950088b7a46e..cebcf8db:/src/panels/terminal/terminalpanel.cpp diff --git a/src/panels/terminal/terminalpanel.cpp b/src/panels/terminal/terminalpanel.cpp index 72886c2e9..e9184e738 100644 --- a/src/panels/terminal/terminalpanel.cpp +++ b/src/panels/terminal/terminalpanel.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include #include @@ -47,6 +47,11 @@ TerminalPanel::TerminalPanel(QWidget *parent) TerminalPanel::~TerminalPanel() { + if (m_konsolePart) { + // Avoid when QObject cleanup, which comes after our destructor, deletes the konsolePart + // and subsequently calls back into our slot when the destructor has already run. + disconnect(m_konsolePart, &KParts::ReadOnlyPart::destroyed, this, &TerminalPanel::terminalExited); + } } void TerminalPanel::goHome() @@ -65,6 +70,7 @@ bool TerminalPanel::currentWorkingDirectoryIsChildOf(const QString &path) const void TerminalPanel::terminalExited() { m_terminal = nullptr; + m_konsolePart = nullptr; Q_EMIT hideTerminalPanel(); } @@ -144,7 +150,7 @@ void TerminalPanel::showEvent(QShowEvent *event) if (!m_terminal) { m_clearTerminal = true; - KPluginFactory *factory = KPluginFactory::loadFactory(KPluginMetaData(QStringLiteral("konsolepart"))).plugin; + KPluginFactory *factory = KPluginFactory::loadFactory(KPluginMetaData(QStringLiteral("kf6/parts/konsolepart"))).plugin; m_konsolePart = factory ? (factory->create(this)) : nullptr; if (m_konsolePart) { connect(m_konsolePart, &KParts::ReadOnlyPart::destroyed, this, &TerminalPanel::terminalExited); @@ -179,6 +185,7 @@ void TerminalPanel::showEvent(QShowEvent *event) "Terminal cannot be shown because Konsole is not installed. " "Please install it and then reopen the panel."); m_konsolePartMissingMessage = new KMessageWidget(konsoleNotInstalledText, this); + m_konsolePartMissingMessage->setPosition(KMessageWidget::Footer); m_konsolePartMissingMessage->setCloseButtonVisible(false); m_konsolePartMissingMessage->hide(); if (KIO::DesktopExecParser::hasSchemeHandler(konsoleInstallUrl)) {