diff options
Diffstat (limited to 'src/panels/terminal/terminalpanel.cpp')
| -rw-r--r-- | src/panels/terminal/terminalpanel.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/panels/terminal/terminalpanel.cpp b/src/panels/terminal/terminalpanel.cpp index 2ed6cd33e..55773345c 100644 --- a/src/panels/terminal/terminalpanel.cpp +++ b/src/panels/terminal/terminalpanel.cpp @@ -50,9 +50,10 @@ 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); + // Delete before QObject child cleanup, while m_konsolePartClientBuilder is still alive. + delete m_konsolePart; + m_konsolePart = nullptr; } } @@ -179,7 +180,8 @@ void TerminalPanel::showEvent(QShowEvent *event) // namely the one of the single inner terminal and not the outer KonsolePart if (!m_konsolePart->factory() && m_terminalWidget) { if (!m_konsolePart->clientBuilder()) { - m_konsolePart->setClientBuilder(new KXMLGUIBuilder(m_terminalWidget)); + m_konsolePartClientBuilder = std::make_unique<KXMLGUIBuilder>(m_terminalWidget); + m_konsolePart->setClientBuilder(m_konsolePartClientBuilder.get()); } auto factory = new KXMLGUIFactory(m_konsolePart->clientBuilder(), this); |
