backport, fixing deletion of window during mouse down handler

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@76586 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2014-05-19 18:40:40 +00:00
parent 794bce48c8
commit 19a0dcc4ca
2 changed files with 7 additions and 2 deletions

View File

@@ -1294,8 +1294,12 @@ void wxWidgetCocoaImpl::mouseEvent(WX_NSEvent event, WXWidget slf, void *_cmd)
superimpl(slf, (SEL)_cmd, event);
// super of built-ins keeps the mouse up, as wx expects this event, we have to synthesize it
// only trigger if at this moment the mouse is already up
if ( [ event type] == NSLeftMouseDown && !wxGetMouseState().LeftIsDown() )
// only trigger if at this moment the mouse is already up, and the control is still existing after the event has
// been handled (we do this by looking up the native NSView's peer from the hash map, that way we are sure the info
// is current - even when the instance memory of ourselves may have been freed ...
wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( slf );
if ( [ event type] == NSLeftMouseDown && !wxGetMouseState().LeftIsDown() && impl != NULL )
{
wxMouseEvent wxevent(wxEVT_LEFT_DOWN);
SetupMouseEvent(wxevent , event) ;

View File

@@ -2875,6 +2875,7 @@ wxWidgetImpl::wxWidgetImpl()
wxWidgetImpl::~wxWidgetImpl()
{
m_wxPeer = NULL;
}
void wxWidgetImpl::Init()