Associate/Disassociate now check for non-NULL pointer instead of requiring
the caller to do so. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21894 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -36,15 +36,21 @@ WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSView)
|
||||
|
||||
void wxCocoaNSView::AssociateNSView(WX_NSView cocoaNSView)
|
||||
{
|
||||
sm_cocoaHash.insert(wxCocoaNSViewHash::value_type(cocoaNSView,this));
|
||||
[[NSNotificationCenter defaultCenter] addObserver:(id)sm_cocoaObserver selector:@selector(notificationFrameChanged:) name:@"NSViewFrameDidChangeNotification" object:cocoaNSView];
|
||||
[cocoaNSView setPostsFrameChangedNotifications: YES];
|
||||
if(cocoaNSView)
|
||||
{
|
||||
sm_cocoaHash.insert(wxCocoaNSViewHash::value_type(cocoaNSView,this));
|
||||
[[NSNotificationCenter defaultCenter] addObserver:(id)sm_cocoaObserver selector:@selector(notificationFrameChanged:) name:@"NSViewFrameDidChangeNotification" object:cocoaNSView];
|
||||
[cocoaNSView setPostsFrameChangedNotifications: YES];
|
||||
}
|
||||
}
|
||||
|
||||
void wxCocoaNSView::DisassociateNSView(WX_NSView cocoaNSView)
|
||||
{
|
||||
sm_cocoaHash.erase(cocoaNSView);
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:(id)sm_cocoaObserver name:@"NSViewFrameDidChangeNotification" object:cocoaNSView];
|
||||
if(cocoaNSView)
|
||||
{
|
||||
sm_cocoaHash.erase(cocoaNSView);
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:(id)sm_cocoaObserver name:@"NSViewFrameDidChangeNotification" object:cocoaNSView];
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user