fix for wxDynamicCast making it safe to pass factory functions.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12854 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -171,9 +171,7 @@ wxObject* WXDLLEXPORT_CTORFN wxConstructorFor##name(void) \
|
|||||||
|
|
||||||
// to be replaced by dynamic_cast<> in the future
|
// to be replaced by dynamic_cast<> in the future
|
||||||
#define wxDynamicCast(obj, className) \
|
#define wxDynamicCast(obj, className) \
|
||||||
((obj) && ((obj)->IsKindOf(&className::sm_class##className)) \
|
(className *) wxCheckDynamicCast((obj), &className::sm_class##className)
|
||||||
? (className *)(obj) \
|
|
||||||
: (className *)0)
|
|
||||||
|
|
||||||
// The 'this' pointer is always true, so use this version to cast the this
|
// The 'this' pointer is always true, so use this version to cast the this
|
||||||
// pointer and avoid compiler warnings.
|
// pointer and avoid compiler warnings.
|
||||||
@@ -295,6 +293,11 @@ private:
|
|||||||
int m_count;
|
int m_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline wxObject *wxCheckDynamicCast(wxObject *obj, wxClassInfo *classInfo)
|
||||||
|
{
|
||||||
|
return obj && obj->GetClassInfo()->IsKindOf(classInfo) ? obj : 0;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
#ifndef WXDEBUG_NEW
|
#ifndef WXDEBUG_NEW
|
||||||
#define WXDEBUG_NEW new(__TFILE__,__LINE__)
|
#define WXDEBUG_NEW new(__TFILE__,__LINE__)
|
||||||
|
Reference in New Issue
Block a user