Moved the debug exit dialog to DebugActions

Qt may crash or freeze if a window is created outside of the main loop
This commit is contained in:
yossizap 2019-12-20 15:41:48 +00:00 committed by Florian Märkl
parent fcb0ca6319
commit 45f7c78726
3 changed files with 12 additions and 3 deletions

View File

@ -3123,9 +3123,7 @@ void CutterCore::handleREvent(int type, void *data)
} }
case R_EVENT_DEBUG_PROCESS_FINISHED: { case R_EVENT_DEBUG_PROCESS_FINISHED: {
auto ev = reinterpret_cast<REventDebugProcessFinished*>(data); auto ev = reinterpret_cast<REventDebugProcessFinished*>(data);
QMessageBox msgBox; emit debugProcessFinished(ev->pid);
msgBox.setText(tr("Debugged process exited (") + QString::number(ev->pid) + ")");
msgBox.exec();
break; break;
} }
default: default:

View File

@ -531,6 +531,11 @@ signals:
void classRenamed(const QString &oldName, const QString &newName); void classRenamed(const QString &oldName, const QString &newName);
void classAttrsChanged(const QString &cls); void classAttrsChanged(const QString &cls);
/**
* @brief end of current debug event received
*/
void debugProcessFinished(int pid);
void attachedRemote(bool successfully); void attachedRemote(bool successfully);
void projectSaved(bool successfully, const QString &name); void projectSaved(bool successfully, const QString &name);

View File

@ -110,6 +110,12 @@ DebugActions::DebugActions(QToolBar *toolBar, MainWindow *main) :
actionContinueUntilCall, actionContinueUntilSyscall}; actionContinueUntilCall, actionContinueUntilSyscall};
toggleConnectionActions = {actionAttach, actionStartRemote}; toggleConnectionActions = {actionAttach, actionStartRemote};
connect(Core(), &CutterCore::debugProcessFinished, this, [ = ](int pid) {
QMessageBox msgBox;
msgBox.setText(tr("Debugged process exited (") + QString::number(pid) + ")");
msgBox.exec();
});
connect(Core(), &CutterCore::debugTaskStateChanged, this, [ = ]() { connect(Core(), &CutterCore::debugTaskStateChanged, this, [ = ]() {
bool disableToolbar = Core()->isDebugTaskInProgress(); bool disableToolbar = Core()->isDebugTaskInProgress();
if (Core()->currentlyDebugging) { if (Core()->currentlyDebugging) {