From 5342bfc5b7f4fd5062ee76c5ee205bb8e14be4b7 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sun, 24 Dec 2023 23:01:59 +0100 Subject: [PATCH] Remove raw event when it has no handlers. fix #2427 --- src/modules/raweditor/RawEditorWindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/raweditor/RawEditorWindow.cpp b/src/modules/raweditor/RawEditorWindow.cpp index e3277673d..5bed0381e 100644 --- a/src/modules/raweditor/RawEditorWindow.cpp +++ b/src/modules/raweditor/RawEditorWindow.cpp @@ -268,7 +268,7 @@ void RawEditorWidget::removeCurrentHandler() m_pEditor->setEnabled(false); m_pNameEditor->setEnabled(false); if(!parent->childCount()) - parent->setEnabled(false); + delete parent; } } @@ -344,7 +344,7 @@ void RawEditorWidget::currentItemChanged(QTreeWidgetItem * it, QTreeWidgetItem * { KVI_ASSERT(m_bOneTimeSetupDone); saveLastEditedItem(); - if(it->parent()) + if(it && it->parent()) { m_pLastEditedItem = (RawHandlerTreeWidgetItem *)it; m_pNameEditor->setEnabled(true); @@ -358,7 +358,7 @@ void RawEditorWidget::currentItemChanged(QTreeWidgetItem * it, QTreeWidgetItem * m_pNameEditor->setEnabled(false); m_pNameEditor->setText(""); m_pEditor->setEnabled(false); - QString szTmp = QString(__tr2qs_ctx("\n\nRAW Event:\n%1", "editor")).arg(((RawHandlerTreeWidgetItem *)it)->text(0)); + QString szTmp = it ? QString(__tr2qs_ctx("\n\nRAW Event:\n%1", "editor")).arg(((RawHandlerTreeWidgetItem *)it)->text(0)) : ""; m_pEditor->setText(szTmp); } }