Skip to content

Commit

Permalink
Moved the debug exit dialog to DebugActions
Browse files Browse the repository at this point in the history
Qt may crash or freeze if a window is created outside of the main loop
  • Loading branch information
yossizap authored and thestr4ng3r committed Dec 20, 2019
1 parent fcb0ca6 commit 45f7c78
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/core/Cutter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3123,9 +3123,7 @@ void CutterCore::handleREvent(int type, void *data)
}
case R_EVENT_DEBUG_PROCESS_FINISHED: {
auto ev = reinterpret_cast<REventDebugProcessFinished*>(data);
QMessageBox msgBox;
msgBox.setText(tr("Debugged process exited (") + QString::number(ev->pid) + ")");
msgBox.exec();
emit debugProcessFinished(ev->pid);
break;
}
default:
Expand Down
5 changes: 5 additions & 0 deletions src/core/Cutter.h
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,11 @@ class CutterCore: public QObject
void classRenamed(const QString &oldName, const QString &newName);
void classAttrsChanged(const QString &cls);

/**
* @brief end of current debug event received
*/
void debugProcessFinished(int pid);

void attachedRemote(bool successfully);

void projectSaved(bool successfully, const QString &name);
Expand Down
6 changes: 6 additions & 0 deletions src/widgets/DebugActions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ DebugActions::DebugActions(QToolBar *toolBar, MainWindow *main) :
actionContinueUntilCall, actionContinueUntilSyscall};
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, [ = ]() {
bool disableToolbar = Core()->isDebugTaskInProgress();
if (Core()->currentlyDebugging) {
Expand Down

0 comments on commit 45f7c78

Please sign in to comment.