┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/panels/terminal/terminalpanel.cpp
diff options
context:
space:
mode:
authorSebastian Englbrecht <[email protected]>2026-05-23 15:31:27 +0200
committerMéven Car <[email protected]>2026-05-28 08:59:00 +0000
commit0d6302ef9be3387d3a62093ae18c92ec84e5a2e1 (patch)
treeda9746a74e90cb04b022770a92aee6617f9f1d52 /src/panels/terminal/terminalpanel.cpp
parent3efeaaffd4cb13168e9327ec146f0a40ff9d75af (diff)
terminalpanel: delete konsolePart in destructor, use unique_ptr for KXMLGUIBuilder
Deleting konsolePart before QObject child cleanup ensures m_konsolePartClientBuilder is still alive when the lambda connected to m_terminalWidget::destroyed fires and calls factory->removeClient().
Diffstat (limited to 'src/panels/terminal/terminalpanel.cpp')
-rw-r--r--src/panels/terminal/terminalpanel.cpp8
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);