1
0
Fork 0

GUI: better thread-safety in the MainWindow + fixed a bug where you could close the 'Closing debugger...' window

This commit is contained in:
Mr. eXoDia 2014-09-07 23:10:27 +02:00
parent acdfe928e1
commit 20d8903b22
4 changed files with 13 additions and 7 deletions

View File

@ -14,3 +14,8 @@ CloseDialog::~CloseDialog()
{
delete ui;
}
void CloseDialog::closeEvent(QCloseEvent* event)
{
event->ignore();
}

View File

@ -2,6 +2,7 @@
#define CLOSEDIALOG_H
#include <QDialog>
#include <QCloseEvent>
namespace Ui
{
@ -15,6 +16,7 @@ class CloseDialog : public QDialog
public:
explicit CloseDialog(QWidget* parent = 0);
~CloseDialog();
void closeEvent(QCloseEvent* event);
private:
Ui::CloseDialog* ui;

View File

@ -204,10 +204,6 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi
DWORD WINAPI MainWindow::closeThread(void* ptr)
{
static bool closing = false;
if(closing)
return 0;
closing = true;
DbgExit();
MainWindow* mainWindow = (MainWindow*)ptr;
mainWindow->bClose = true;
@ -220,7 +216,12 @@ void MainWindow::closeEvent(QCloseEvent* event)
hide(); //hide main window
mCloseDialog->show();
mCloseDialog->setFocus();
static bool bExecuteThread = true;
if(bExecuteThread)
{
bExecuteThread = false;
CloseHandle(CreateThread(0, 0, closeThread, this, 0, 0));
}
if(bClose)
event->accept();
else

View File

@ -86,5 +86,3 @@ int main(int argc, char* argv[])
mConfiguration->save(); //save config on exit
return result;
}