mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-01 08:29:27 +02:00
Bug 2250 - Closing Screenshot dialog within the 5 second wait window causes a crash
Timer notify was happening after the window closed.
This commit is contained in:
parent
a0578f71c3
commit
2ad3fe5406
@ -50,6 +50,7 @@ It forwards the actual work of doing the commands to the ScreenshotCommand.
|
|||||||
#include "WaveTrack.h"
|
#include "WaveTrack.h"
|
||||||
|
|
||||||
class OldStyleCommandType;
|
class OldStyleCommandType;
|
||||||
|
class ScreenFrameTimer;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -106,6 +107,8 @@ class ScreenshotBigDialog final : public wxFrame
|
|||||||
wxToggleButton *mWhite;
|
wxToggleButton *mWhite;
|
||||||
wxStatusBar *mStatus;
|
wxStatusBar *mStatus;
|
||||||
|
|
||||||
|
std::unique_ptr<ScreenFrameTimer> mTimer;
|
||||||
|
|
||||||
std::unique_ptr<ScreenshotCommand> mCommand;
|
std::unique_ptr<ScreenshotCommand> mCommand;
|
||||||
const CommandContext mContext;
|
const CommandContext mContext;
|
||||||
|
|
||||||
@ -158,7 +161,6 @@ class ScreenFrameTimer final : public wxTimer
|
|||||||
// Process timer notification just once, then destroy self
|
// Process timer notification just once, then destroy self
|
||||||
evt->SetEventObject(NULL);
|
evt->SetEventObject(NULL);
|
||||||
screenFrame->ProcessEvent(*evt);
|
screenFrame->ProcessEvent(*evt);
|
||||||
delete this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -505,9 +507,8 @@ bool ScreenshotBigDialog::ProcessEvent(wxEvent & e)
|
|||||||
{
|
{
|
||||||
if( id >= IdAllDelayedEvents && id <= IdLastDelayedEvent &&
|
if( id >= IdAllDelayedEvents && id <= IdLastDelayedEvent &&
|
||||||
e.GetEventObject() != NULL) {
|
e.GetEventObject() != NULL) {
|
||||||
// safenew because it's a one-shot that deletes itself
|
mTimer = std::make_unique<ScreenFrameTimer>(this, e);
|
||||||
ScreenFrameTimer *timer = safenew ScreenFrameTimer(this, e);
|
mTimer->Start(5000, true);
|
||||||
timer->Start(5000, true);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -520,11 +521,13 @@ bool ScreenshotBigDialog::ProcessEvent(wxEvent & e)
|
|||||||
|
|
||||||
void ScreenshotBigDialog::OnCloseWindow(wxCloseEvent & WXUNUSED(event))
|
void ScreenshotBigDialog::OnCloseWindow(wxCloseEvent & WXUNUSED(event))
|
||||||
{
|
{
|
||||||
|
mTimer->Stop();
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenshotBigDialog::OnClose(wxCommandEvent & WXUNUSED(event))
|
void ScreenshotBigDialog::OnClose(wxCommandEvent & WXUNUSED(event))
|
||||||
{
|
{
|
||||||
|
mTimer->Stop();
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user