VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/Forms/WaitDialog.h
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2018-04-28 17:53:57 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2018-04-28 17:56:27 +0200
commit7a842266b3f2e69d1706aec3039b661e3a5b25dd (patch)
treec3d3d268a4871510a36c21c451bc8c1b0a9c2e9d /src/Main/Forms/WaitDialog.h
parentbd7bbfaa8f262cb8d94c1d868db45cd758bcab60 (diff)
downloadVeraCrypt-7a842266b3f2e69d1706aec3039b661e3a5b25dd.tar.gz
VeraCrypt-7a842266b3f2e69d1706aec3039b661e3a5b25dd.zip
Linux: Fix crash if user is able to close the waiting dialog before the operation is finished. This can happen if GTK installation show "X" closing icon even if it is programmatically disabled (e.g. on Lubuntu 16.04)
Diffstat (limited to 'src/Main/Forms/WaitDialog.h')
-rw-r--r--src/Main/Forms/WaitDialog.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/Main/Forms/WaitDialog.h b/src/Main/Forms/WaitDialog.h
index a3b14179..33f044c9 100644
--- a/src/Main/Forms/WaitDialog.h
+++ b/src/Main/Forms/WaitDialog.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2013-2017 IDRIX. All rights reserved.
+ Copyright (c) 2013-2018 IDRIX. All rights reserved.
Governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
@@ -47,7 +47,7 @@ namespace VeraCrypt
{
public:
WaitDialog (wxWindow *parent, const wxString& label, WaitThreadRoutine* pRoutine)
- : WaitDialogBase(parent), WaitThreadUI(pRoutine), m_timer (this)
+ : WaitDialogBase(parent), WaitThreadUI(pRoutine), m_bThreadRunning (false), m_timer (this)
{
WaitStaticText->SetLabel (label);
WaitProgessBar->Pulse();
@@ -76,6 +76,7 @@ namespace VeraCrypt
{
m_thread->Run();
m_timer.Start(100);
+ m_bThreadRunning = true;
}
int GetCharWidth (wxWindow *window) const
@@ -144,9 +145,19 @@ namespace VeraCrypt
pin = wxT("");
}
- // virtual void OnWaitDialogClose( wxCloseEvent& event ) { }
+ virtual void OnWaitDialogClose( wxCloseEvent& event )
+ {
+ if (event.CanVeto () && m_bThreadRunning)
+ {
+ event.Veto ();
+ }
+ else
+ event.Skip ();
+ }
+
void OnThreadCompletion(wxCommandEvent &)
{
+ m_bThreadRunning = false;
m_queue.Clear();
EndModal(0);
}
@@ -202,6 +213,7 @@ namespace VeraCrypt
protected:
WaitThread* m_thread;
+ bool m_bThreadRunning;
wxTimer m_timer;
wxMessageQueue<wxString> m_queue;
};