kate: fix crash in onSessionKilled

QTextDocument::setHtml was called while the document was still
tearing down from clear(). Defer refreshSessions to the next
event loop iteration with QTimer::singleShot(0, ...).
This commit is contained in:
Levi Neely 2026-07-31 16:34:33 +02:00
parent 5dfdd2bd31
commit f00ed7738d
1 changed files with 5 additions and 1 deletions

View File

@ -28,6 +28,7 @@
#include <QFileInfo>
#include <QInputDialog>
#include <QScrollBar>
#include <QTimer>
#include <QCheckBox>
#include <QSet>
#include <QFormLayout>
@ -524,7 +525,10 @@ void OllieKateView::onSessionKilled(const QString &session_id)
m_chatView->clear();
m_sessionLabel->setText("No session");
m_cwdLabel->setText("");
refreshSessions();
// Defer session switch to let Qt finish processing the D-Bus signal.
// Calling render() synchronously here can crash because the QTextDocument
// is still tearing down resources from the clear() above.
QTimer::singleShot(0, this, &OllieKateView::refreshSessions);
}
}