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

Small TrackPanel fixes, including bug 1662, popup menu crashes

This commit is contained in:
Paul Licameli 2017-06-17 20:04:33 -04:00
commit 9b06f76f6f

View File

@ -1480,23 +1480,26 @@ try
} }
else if (event.ButtonUp()) { else if (event.ButtonUp()) {
// UIHANDLE RELEASE // UIHANDLE RELEASE
auto uiHandle = mUIHandle;
// Null this pointer out first before calling Release -- because on Windows, we can
// come back recursively to this place during handling of the context menu,
// because of a capture lost event.
mUIHandle = nullptr;
UIHandle::Result refreshResult = UIHandle::Result refreshResult =
mUIHandle->Release( tpmEvent, GetProject(), this ); uiHandle->Release( tpmEvent, GetProject(), this );
ProcessUIHandleResult(this, mRuler, mpClickedTrack, pTrack, refreshResult); ProcessUIHandleResult(this, mRuler, mpClickedTrack, pTrack, refreshResult);
mUIHandle = NULL;
mpClickedTrack = NULL; mpClickedTrack = NULL;
// will also Uncapture() below // will also Uncapture() below
} }
} }
else if ( event.GetEventType() == wxEVT_MOTION ) else if ( event.GetEventType() == wxEVT_MOTION )
// Update status message and cursor, not during drag // Update status message and cursor, not during drag
// (consider it not a drag, even if button is down during motion, if // consider it not a drag, even if button is down during motion, if
// mUIHandle is null, as it becomes during interrupted drag // mUIHandle is null, as it becomes during interrupted drag
// (e.g. by hitting space to play while dragging an envelope point) // (e.g. by hitting space to play while dragging an envelope point)
HandleCursor( &event ); HandleCursor( &event );
else if ( event.ButtonDown() || event.ButtonDClick() ) { else if ( event.ButtonDown() || event.ButtonDClick() )
HandleClick( tpmEvent ); HandleClick( tpmEvent );
}
if (event.ButtonDown() && IsMouseCaptured()) { if (event.ButtonDown() && IsMouseCaptured()) {
if (!HasCapture()) if (!HasCapture())
@ -3178,7 +3181,7 @@ void TrackPanelCellIterator::UpdateRect()
// tall zone below, in case there is no next track) // tall zone below, in case there is no next track)
auto partner = mpTrack->GetLink(); auto partner = mpTrack->GetLink();
if ( partner && mpTrack->GetLinked() ) if ( partner && mpTrack->GetLinked() )
mRect.x = mPanel->GetLeftOffset(); mRect.x = kTrackInfoWidth;
else else
mRect.x = kLeftMargin; mRect.x = kLeftMargin;
mRect.width -= (mRect.x + kRightMargin); mRect.width -= (mRect.x + kRightMargin);