From 2eaafae30f8bb8e924c6fbba91c0fa176cde8920 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Thu, 28 Nov 2024 22:34:35 +0800 Subject: [PATCH] fix: actions status don't update when debug finished --- RedPandaIDE/debugger/debugger.cpp | 7 ++++--- RedPandaIDE/debugger/debugger.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/RedPandaIDE/debugger/debugger.cpp b/RedPandaIDE/debugger/debugger.cpp index 0631633de..26d8b8259 100644 --- a/RedPandaIDE/debugger/debugger.cpp +++ b/RedPandaIDE/debugger/debugger.cpp @@ -83,7 +83,7 @@ bool Debugger::startClient(int compilerSetIndex, const QString& sourceFile) { QMutexLocker locker{&mClientMutex}; - if (mClient) + if (mClient!=nullptr) return false; mCurrentSourceFile = sourceFile; Settings::PCompilerSet compilerSet = pSettings->compilerSets().getSet(compilerSetIndex); @@ -161,6 +161,8 @@ bool Debugger::startClient(int compilerSetIndex, mClient->addBinDirs(binDirs); mClient->addBinDir(pSettings->dirs().appDir()); mClient->setDebuggerPath(debuggerPath); + connect(this, &Debugger::debugEnded, pMainWindow, + QOverload<>::of(&MainWindow::updateEditorActions)); connect(mClient, &QThread::finished,this,&Debugger::cleanUp); connect(mClient, &QThread::finished,mMemoryModel.get(),&MemoryModel::reset); connect(mClient, &DebuggerClient::parseFinished,this,&Debugger::syncFinishedParsing,Qt::BlockingQueuedConnection); @@ -272,13 +274,12 @@ void Debugger::cleanUp() mBreakpointModel->invalidateAllBreakpointNumbers(); - pMainWindow->updateEditorActions(); - //stop debugger mClient->stopDebug(); mClient->deleteLater(); mClient = nullptr; } + emit debugEnded(); } void Debugger::updateRegisterNames(const QStringList ®isterNames) diff --git a/RedPandaIDE/debugger/debugger.h b/RedPandaIDE/debugger/debugger.h index 008d35351..1f5440562 100644 --- a/RedPandaIDE/debugger/debugger.h +++ b/RedPandaIDE/debugger/debugger.h @@ -401,6 +401,7 @@ class Debugger : public QObject void evalValueReady(const QString& s); void memoryExamineReady(const QStringList& s); void localsReady(const QStringList& s); + void debugEnded(); public slots: void stop(); void refreshAll();