1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-22 08:31:14 +01:00

TrackButtonHandle keeps weak_ptr to the cell

This commit is contained in:
Paul Licameli
2017-06-27 20:17:44 -04:00
parent b0c6a67c33
commit e2f0a16839
3 changed files with 11 additions and 5 deletions

View File

@@ -148,11 +148,15 @@ MenuButtonHandle &MenuButtonHandle::Instance()
UIHandle::Result MenuButtonHandle::CommitChanges
(const wxMouseEvent &, AudacityProject *, wxWindow *pParent)
{
return mpCell->DoContextMenu(mRect, pParent, NULL);
auto pCell = mpCell.lock();
if (!pCell)
return RefreshCode::Cancelled;
return pCell->DoContextMenu(mRect, pParent, NULL);
}
HitTestResult MenuButtonHandle::HitTest
(const wxMouseEvent &event, const wxRect &rect, TrackPanelCell *pCell)
(const wxMouseEvent &event, const wxRect &rect,
const std::shared_ptr<TrackPanelCell> &pCell)
{
wxRect buttonRect;
TrackInfo::GetTitleBarRect(rect, buttonRect);