GUI: better thread-safety in the MainWindow + fixed a bug where you could close the 'Closing debugger...' window
This commit is contained in:
parent
acdfe928e1
commit
20d8903b22
|
@ -14,3 +14,8 @@ CloseDialog::~CloseDialog()
|
|||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void CloseDialog::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
event->ignore();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
CloseHandle(CreateThread(0, 0, closeThread, this, 0, 0));
|
||||
static bool bExecuteThread = true;
|
||||
if(bExecuteThread)
|
||||
{
|
||||
bExecuteThread = false;
|
||||
CloseHandle(CreateThread(0, 0, closeThread, this, 0, 0));
|
||||
}
|
||||
if(bClose)
|
||||
event->accept();
|
||||
else
|
||||
|
|
|
@ -86,5 +86,3 @@ int main(int argc, char* argv[])
|
|||
mConfiguration->save(); //save config on exit
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue