Retain/release the NSButtonCell during user action so that if the button
is deleted by the user action the program does not crash sending the setHighlighted:NO message to it. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31158 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -253,6 +253,7 @@ bool wxToolBar::Cocoa_mouseDragged(WX_NSEvent theEvent)
|
|||||||
NSButtonCell *buttonCell = m_mouseDownTool->GetNSButtonCell();
|
NSButtonCell *buttonCell = m_mouseDownTool->GetNSButtonCell();
|
||||||
if(buttonCell)
|
if(buttonCell)
|
||||||
{
|
{
|
||||||
|
[buttonCell retain];
|
||||||
[buttonCell setHighlighted: YES];
|
[buttonCell setHighlighted: YES];
|
||||||
if([buttonCell trackMouse: theEvent
|
if([buttonCell trackMouse: theEvent
|
||||||
inRect:AddToolPadding(m_mouseDownTool->GetFrameRect()) ofView:m_cocoaNSView
|
inRect:AddToolPadding(m_mouseDownTool->GetFrameRect()) ofView:m_cocoaNSView
|
||||||
@@ -263,6 +264,7 @@ bool wxToolBar::Cocoa_mouseDragged(WX_NSEvent theEvent)
|
|||||||
wxLogTrace(wxTRACE_COCOA,wxT("Button was clicked after drag!"));
|
wxLogTrace(wxTRACE_COCOA,wxT("Button was clicked after drag!"));
|
||||||
}
|
}
|
||||||
[buttonCell setHighlighted: NO];
|
[buttonCell setHighlighted: NO];
|
||||||
|
[buttonCell release];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return wxToolBarBase::Cocoa_mouseDragged(theEvent);
|
return wxToolBarBase::Cocoa_mouseDragged(theEvent);
|
||||||
@@ -276,6 +278,7 @@ bool wxToolBar::Cocoa_mouseDown(WX_NSEvent theEvent)
|
|||||||
NSButtonCell *buttonCell = tool->GetNSButtonCell();
|
NSButtonCell *buttonCell = tool->GetNSButtonCell();
|
||||||
if(buttonCell)
|
if(buttonCell)
|
||||||
{
|
{
|
||||||
|
[buttonCell retain];
|
||||||
m_mouseDownTool = tool;
|
m_mouseDownTool = tool;
|
||||||
[buttonCell setHighlighted: YES];
|
[buttonCell setHighlighted: YES];
|
||||||
if([buttonCell trackMouse: theEvent
|
if([buttonCell trackMouse: theEvent
|
||||||
@@ -287,6 +290,7 @@ bool wxToolBar::Cocoa_mouseDown(WX_NSEvent theEvent)
|
|||||||
wxLogTrace(wxTRACE_COCOA,wxT("Button was clicked!"));
|
wxLogTrace(wxTRACE_COCOA,wxT("Button was clicked!"));
|
||||||
}
|
}
|
||||||
[buttonCell setHighlighted: NO];
|
[buttonCell setHighlighted: NO];
|
||||||
|
[buttonCell release];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return wxToolBarBase::Cocoa_mouseDown(theEvent);
|
return wxToolBarBase::Cocoa_mouseDown(theEvent);
|
||||||
|
Reference in New Issue
Block a user