X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e668651137922bee36b5773d638aa696e78854d1..b76fa6fe3b9cef9fe11e63b6c6c5659998af12a3:/include/wx/cocoa/ObjcAssociate.h diff --git a/include/wx/cocoa/ObjcAssociate.h b/include/wx/cocoa/ObjcAssociate.h index 4a460143e0..31b087e46c 100644 --- a/include/wx/cocoa/ObjcAssociate.h +++ b/include/wx/cocoa/ObjcAssociate.h @@ -45,11 +45,13 @@ WX_DECLARE_OBJC_INTERFACE_HASHMAP(ObjcClass) \ public: \ inline void Associate##ObjcClass(WX_##ObjcClass cocoaObjcClass) \ { \ - sm_cocoaHash.insert(wxCocoa##ObjcClass##Hash::value_type(cocoaObjcClass,this)); \ + if(cocoaObjcClass) \ + sm_cocoaHash.insert(wxCocoa##ObjcClass##Hash::value_type(cocoaObjcClass,this)); \ } \ inline void Disassociate##ObjcClass(WX_##ObjcClass cocoaObjcClass) \ { \ - sm_cocoaHash.erase(cocoaObjcClass); \ + if(cocoaObjcClass) \ + sm_cocoaHash.erase(cocoaObjcClass); \ } #define WX_IMPLEMENT_OBJC_INTERFACE(ObjcClass) \ @@ -68,11 +70,9 @@ protected: \ #define WX_IMPLEMENT_COCOA_OWNER(wxClass,ObjcClass,ObjcBase,ObjcRoot) \ void wxClass::Set##ObjcClass(WX_##ObjcClass cocoaObjcClass) \ { \ - if(m_cocoa##ObjcRoot) \ - Disassociate##ObjcClass((WX_##ObjcClass)m_cocoa##ObjcRoot); \ + Disassociate##ObjcClass((WX_##ObjcClass)m_cocoa##ObjcRoot); \ Set##ObjcBase(cocoaObjcClass); \ - if(m_cocoa##ObjcRoot) \ - Associate##ObjcClass((WX_##ObjcClass)m_cocoa##ObjcRoot); \ + Associate##ObjcClass((WX_##ObjcClass)m_cocoa##ObjcRoot); \ } #endif // __WX_COCOA_OBJC_ASSOCIATE_H__