OSDN Git Service

[Qt][Debugger] Not hang-up when Opening debugger and exit emu{foo}. This is temporall...
authorK.Ohta <whatisthis.sowhat@gmail.com>
Mon, 19 Sep 2016 13:31:02 +0000 (22:31 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Mon, 19 Sep 2016 13:31:02 +0000 (22:31 +0900)
source/src/qt/common/qt_utils.cpp
source/src/qt/debugger/qt_debugger.cpp
source/src/qt/debugger/qt_debugger.h

index feb61ef..9a0449c 100644 (file)
@@ -437,6 +437,7 @@ void Ui_MainWindow::OnMainWindowClosed(void)
                delete hDrawEmu;
        }
        if(hRunEmu != NULL) {
+               hRunEmu->quit();
                hRunEmu->wait();
                delete hRunEmu;
        }
@@ -702,6 +703,7 @@ void Ui_MainWindow::OnOpenDebugger(int no)
                        emu->stop_record_video();
                        emu->now_debugging = true;
                        connect(this, SIGNAL(quit_debugger_thread()), emu->hDebugger, SLOT(doExit()));
+                       connect(this, SIGNAL(destroyed()), emu->hDebugger, SLOT(do_destroy_thread()));
                        //connect(this, SIGNAL(quit_debugger_thread()), emu->hDebugger, SLOT(close()));
                        connect(emu->hDebugger, SIGNAL(sig_finished()), this, SLOT(OnCloseDebugger()));
                        connect(emu->hDebugger, SIGNAL(sig_put_string(QString)), emu->hDebugger, SLOT(put_string(QString)));
index 996eb4d..4737144 100644 (file)
@@ -32,7 +32,6 @@ void CSP_Debugger::call_debugger(void)
 #if defined(USE_DEBUGGER)
        OSD *osd = debugger_thread_param.osd;
        osd->do_set_input_string(text_command->text());
-//     emit sig_call_debugger(text_command->text());
 #endif 
        cmd_clear();
 }
@@ -65,6 +64,21 @@ void CSP_Debugger::closeEvent(QCloseEvent *event)
        event->ignore();
 }
 
+void CSP_Debugger::do_destroy_thread(void)
+{
+#if defined(USE_DEBUGGER)
+       if(main_thread != NULL) {
+               if(main_thread->isRunning()) {
+                       main_thread->quit_debugger();
+                       main_thread->terminate();
+               }
+               delete main_thread;
+       }
+       main_thread = NULL;
+#endif
+       this->close();
+}
+
 CSP_Debugger::CSP_Debugger(QWidget *parent) : CSP_Debugger_Tmpl(parent)
 {
 #if defined(USE_DEBUGGER)      
index e052297..801abce 100644 (file)
@@ -47,6 +47,7 @@ public slots:
        void doExit2(void);
        void call_debugger(void);
        void run(void);
+       void do_destroy_thread(void);
 signals:
        void sig_put_string(QString);
        void sig_run_command(QString);