Bug1318: ESC key or red close button should not leave the app unresponsive...

... I don't fully understand why this fixes it, but I could figure out what
was different between ESC and Cancel button which did not have the problem.
This commit is contained in:
Paul Licameli 2016-04-23 08:49:11 -04:00
parent 367b2c1011
commit 879ecefdaa
2 changed files with 20 additions and 12 deletions

View File

@ -3192,6 +3192,8 @@ void EffectUIHost::OnPaint(wxPaintEvent & WXUNUSED(evt))
void EffectUIHost::OnClose(wxCloseEvent & WXUNUSED(evt))
{
DoCancel();
CleanupRealtime();
Hide();
@ -3261,20 +3263,23 @@ void EffectUIHost::OnApply(wxCommandEvent & evt)
return;
}
void EffectUIHost::DoCancel()
{
if (!mCancelled) {
mEffect->mUIResultID = wxID_CANCEL;
if (IsModal())
EndModal(false);
else
Hide();
mCancelled = true;
}
}
void EffectUIHost::OnCancel(wxCommandEvent & evt)
{
mEffect->mUIResultID = evt.GetId();
if (IsModal())
{
EndModal(false);
Close();
return;
}
Hide();
DoCancel();
Close();

View File

@ -596,6 +596,7 @@ private:
void OnPaint(wxPaintEvent & evt);
void OnClose(wxCloseEvent & evt);
void OnApply(wxCommandEvent & evt);
void DoCancel();
void OnCancel(wxCommandEvent & evt);
void OnDebug(wxCommandEvent & evt);
void OnMenu(wxCommandEvent & evt);
@ -658,6 +659,8 @@ private:
SelectedRegion mRegion;
double mPlayPos;
bool mCancelled{};
DECLARE_EVENT_TABLE();
};