From 6fba4a47c7eaeab6c13c0f4a7e316af8f28ecb5e Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Wed, 30 Sep 2026 16:09:01 +0800 Subject: [PATCH] fix: add missing semicolon and null guards in editor code - iflytek_ai_assistant.cpp: stopTtsDirectly() missed a semicolon inside the ENABLE_STOP_TTS branch; defining the macro broke the build. - FlashTween.h: stopX()/stopY()/activeX()/activeY() dereferenced the timers without the null guards used by startX()/startY(). - deletebackcommond.cpp: DeleteBackCommand::undo()/redo() dereferenced m_edit without the if (m_edit) guard used by the sibling command classes. Log: Influence: editor widget --- src/common/iflytek_ai_assistant.cpp | 2 +- src/editor/FlashTween.h | 10 +++++----- src/editor/deletebackcommond.cpp | 8 +++++++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/common/iflytek_ai_assistant.cpp b/src/common/iflytek_ai_assistant.cpp index 5572dea88..c9f37ca7f 100644 --- a/src/common/iflytek_ai_assistant.cpp +++ b/src/common/iflytek_ai_assistant.cpp @@ -271,7 +271,7 @@ IflytekAiAssistant::CallStatus IflytekAiAssistant::stopTtsDirectly() const // BUG-301561 : disable stop tts when close tab or window #ifdef ENABLE_STOP_TTS qDebug() << "ENABLE_STOP_TTS is defined!"; - return stopTtsDirectlyInternal() + return stopTtsDirectlyInternal(); #else qDebug() << "ENABLE_STOP_TTS is not defined!, return Enable"; return Enable; diff --git a/src/editor/FlashTween.h b/src/editor/FlashTween.h index 15e685b6d..18b786662 100644 --- a/src/editor/FlashTween.h +++ b/src/editor/FlashTween.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2011-2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2011-2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -27,10 +27,10 @@ class FlashTween :public QObject void startX(qreal t,qreal b,qreal c,qreal d, FunSlideInertial fSlideGesture); void startY(qreal t,qreal b,qreal c,qreal d, FunSlideInertial fSlideGesture); - void stopX(){m_timerX->stop();} - void stopY(){m_timerY->stop();} - bool activeX(){return m_timerX->isActive();} - bool activeY(){return m_timerY->isActive();} + void stopX(){if (m_timerX != nullptr) m_timerX->stop();} + void stopY(){if (m_timerY != nullptr) m_timerY->stop();} + bool activeX(){return m_timerX != nullptr && m_timerX->isActive();} + bool activeY(){return m_timerY != nullptr && m_timerY->isActive();} private slots: void __runY(); diff --git a/src/editor/deletebackcommond.cpp b/src/editor/deletebackcommond.cpp index 3d61fab15..e192c0eb8 100644 --- a/src/editor/deletebackcommond.cpp +++ b/src/editor/deletebackcommond.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022 - 2023 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022-2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -29,6 +29,9 @@ void DeleteBackCommand::undo() { qDebug() << "DeleteBackCommand undo - inserting text at:" << m_insertPos << ", length:" << m_delText.length(); + if (nullptr == m_edit) { + return; + } m_cursor.setPosition(m_insertPos); m_cursor.insertText(m_delText); @@ -42,6 +45,9 @@ void DeleteBackCommand::redo() { qDebug() << "DeleteBackCommand redo - deleting text at:" << m_delPos << ", length:" << m_delText.length(); + if (nullptr == m_edit) { + return; + } m_cursor.setPosition(m_delPos); m_cursor.setPosition(m_delPos + m_delText.size(), QTextCursor::KeepAnchor); m_cursor.deleteChar();