mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-17 17:17:40 +02:00
TrackButtonHandle keeps weak_ptr to the cell
This commit is contained in:
parent
b0c6a67c33
commit
e2f0a16839
@ -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);
|
||||
|
@ -76,10 +76,11 @@ protected:
|
||||
|
||||
public:
|
||||
static HitTestResult HitTest
|
||||
(const wxMouseEvent &event, const wxRect &rect, TrackPanelCell *pCell);
|
||||
(const wxMouseEvent &event, const wxRect &rect,
|
||||
const std::shared_ptr<TrackPanelCell> &pCell);
|
||||
|
||||
private:
|
||||
TrackPanelCell *mpCell{};
|
||||
std::weak_ptr<TrackPanelCell> mpCell;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -48,7 +48,8 @@ HitTestResult TrackControls::HitTest
|
||||
if (NULL != (result = CloseButtonHandle::HitTest(event, rect)).handle)
|
||||
return result;
|
||||
|
||||
if (NULL != (result = MenuButtonHandle::HitTest(event, rect, this)).handle)
|
||||
if (NULL != (result = MenuButtonHandle::HitTest(event, rect,
|
||||
this->FindTrack()->GetTrackControl())).handle)
|
||||
return result;
|
||||
|
||||
if (NULL != (result = MinimizeButtonHandle::HitTest(event, rect)).handle)
|
||||
|
Loading…
x
Reference in New Issue
Block a user