OSDN Git Service

[UI][Qt][Draw] Fix unterminated Draw thread.
authorK.Ohta <whatisthis.sowhat@gmail.com>
Thu, 16 Apr 2015 16:42:07 +0000 (01:42 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Thu, 16 Apr 2015 16:42:07 +0000 (01:42 +0900)
source/src/qt/common/qt_main.cpp
source/src/qt/common/qt_main.h

index 6d2c04f..be12b45 100644 (file)
@@ -211,16 +211,13 @@ void DrawThreadClass::doDraw(void)
 void DrawThreadClass::doExit(void)
 {
        bRunThread = false;
+       this->quit();
+       this->wait();
+       AGAR_DebugLog(AGAR_LOG_DEBUG, "DrawThread : Exit.");
 }
 
 void DrawThreadClass::doWork(const QString &param)
 {
-       bRunThread = true;
-       do {
-               if(bRunThread == false) break;
-               msleep(100);
-       } while(1);
-       AGAR_DebugLog(AGAR_LOG_DEBUG, "DrawThread : EXIT");
 }
 
 
@@ -267,8 +264,8 @@ void Ui_MainWindow::LaunchEmuThread(void)
        connect(hDrawEmu, SIGNAL(sig_draw_frames(int)), hRunEmu, SLOT(print_framerate(int)));
        connect(hDrawEmu, SIGNAL(message_changed(QString)), this, SLOT(message_status_bar(QString)));
        connect(hRunEmu, SIGNAL(sig_draw_thread()), hDrawEmu, SLOT(doDraw()));
-       connect(this, SIGNAL(quit_draw_thread()), hDrawEmu, SLOT(doExit()));
-       connect(hRunEmu, SIGNAL(sig_finished()), this, SLOT(delete_draw_thread()));
+       connect(hRunEmu, SIGNAL(quit_draw_thread()), hDrawEmu, SLOT(doExit()));
+       //connect(hRunEmu, SIGNAL(sig_finished()), this, SLOT(delete_draw_thread()));
        objNameStr = QString("EmuDrawThread");
        hDrawEmu->setObjectName(objNameStr);
        hDrawEmu->start();
@@ -279,9 +276,9 @@ void Ui_MainWindow::LaunchEmuThread(void)
 
 }
 
+
 void Ui_MainWindow::StopEmuThread(void) {
        emit quit_emu_thread();
-       //emit quit_draw_thread();
 }
 
 void Ui_MainWindow::delete_emu_thread(void)
index 75a3d77..b5c1413 100644 (file)
@@ -101,6 +101,7 @@ class EmuThreadClass : public QThread {
  signals:
   int message_changed(QString);
   int sig_draw_thread(void);
+  int quit_draw_thread(void);
   int sig_screen_aspect(int);
   int sig_screen_size(int, int);
   int sig_finished(void);