1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-04 17:49:45 +02:00

Fix crashes when ESCaping a drag

This commit is contained in:
Paul Licameli 2017-07-13 07:03:30 -04:00
parent 6c0b3bb1bf
commit 5e4f453a81
2 changed files with 10 additions and 3 deletions

View File

@ -753,11 +753,18 @@ namespace
} }
} }
void TrackPanel::Uncapture(wxMouseEvent *pEvent) void TrackPanel::Uncapture(wxMouseState *pState)
{ {
auto state = ::wxGetMouseState();
if (!pState) {
// Remap the position
state.SetPosition(this->ScreenToClient(state.GetPosition()));
pState = &state;
}
if (HasCapture()) if (HasCapture())
ReleaseMouse(); ReleaseMouse();
HandleMotion( *pEvent ); HandleMotion( *pState );
} }
void TrackPanel::CancelDragging() void TrackPanel::CancelDragging()

View File

@ -313,7 +313,7 @@ class AUDACITY_DLL_API TrackPanel final : public OverlayPanel {
// void SetSnapTo(int snapto) // void SetSnapTo(int snapto)
void HandleInterruptedDrag(); void HandleInterruptedDrag();
void Uncapture( wxMouseEvent *pEvent = nullptr ); void Uncapture( wxMouseState *pState = nullptr );
void CancelDragging(); void CancelDragging();
bool HandleEscapeKey(bool down); bool HandleEscapeKey(bool down);
void UpdateMouseState(const wxMouseState &state); void UpdateMouseState(const wxMouseState &state);