1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-25 00:48:10 +02:00

Fix bug 1662 (crashing TCP menu commands on Windows) differently...

Previous fix was at commit f9865f39efe46224a1a77c742a789b2cc70f0c54

But then that had this strange effect on Mac:  when a menu command such as
rename brought up a modal dialog, then the first click in the dialog would pass
through to the tracks behind it, changing the selection, and only a repeated
click on the OK button would dismiss the dialog.

I don't know exactly why that happened.  This avoids it.
This commit is contained in:
Paul Licameli 2017-07-16 02:52:51 -04:00 committed by Paul Licameli
parent f3574c6238
commit 1faa234b9e
2 changed files with 10 additions and 8 deletions

View File

@ -1689,17 +1689,13 @@ try
}
else if (event.ButtonUp()) {
// UIHANDLE RELEASE
auto uiHandle = mUIHandle;
// Null mUIHandle 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.
unsigned moreFlags = mMouseOverUpdateFlags;
mUIHandle.reset(), ClearTargets();
UIHandle::Result refreshResult =
uiHandle->Release( tpmEvent, GetProject(), this );
mUIHandle->Release( tpmEvent, GetProject(), this );
ProcessUIHandleResult
(this, mRuler, pClickedTrack.get(), pTrack.get(),
refreshResult | moreFlags);
mUIHandle.reset(), ClearTargets();
mpClickedTrack.reset();
// will also Uncapture() below
}

View File

@ -152,12 +152,18 @@ MenuButtonHandle::~MenuButtonHandle()
}
UIHandle::Result MenuButtonHandle::CommitChanges
(const wxMouseEvent &, AudacityProject *, wxWindow *pParent)
(const wxMouseEvent &, AudacityProject *pProject, wxWindow *pParent)
{
auto pPanel = pProject->GetTrackPanel();
auto pCell = mpCell.lock();
if (!pCell)
return RefreshCode::Cancelled;
return pCell->DoContextMenu(mRect, pParent, NULL);
auto pTrack =
static_cast<CommonTrackPanelCell*>(pCell.get())->FindTrack();
if (!pTrack)
return RefreshCode::Cancelled;
pPanel->CallAfter( [=]{ pPanel->OnTrackMenu( pTrack.get() ); } );
return RefreshCode::RefreshNone;
}
wxString MenuButtonHandle::Tip(const wxMouseState &) const