X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a9bf8315f626419bc5ed8616475df446e3608c23..4a46a5df879c4f820d0a0a435b34c7d5e4793991:/src/common/object.cpp diff --git a/src/common/object.cpp b/src/common/object.cpp index 7bf7dbdc11..ab3ef77b87 100644 --- a/src/common/object.cpp +++ b/src/common/object.cpp @@ -151,8 +151,22 @@ wxClassInfo *wxClassInfo::FindClass(const wxChar *className) } } - // Set pointers to base class(es) to speed up IsKindOf +// a tiny InitializeClasses() helper +/* static */ +inline wxClassInfo *wxClassInfo::GetBaseByName(const wxChar *name) +{ + if ( !name ) + return NULL; + + wxClassInfo *classInfo = (wxClassInfo *)sm_classTable->Get(name); + + // this must be fixed, other things risk work wrongly later if you get this + wxASSERT_MSG( classInfo, _T("base class unknown to wxWindows RTTI") ); + + return classInfo; +} +// Set pointers to base class(es) to speed up IsKindOf void wxClassInfo::InitializeClasses() { // using IMPLEMENT_DYNAMIC_CLASS() macro twice (which may happen if you @@ -185,10 +199,8 @@ void wxClassInfo::InitializeClasses() for(info = sm_first; info; info = info->m_next) { - if (info->GetBaseClassName1()) - info->m_baseInfo1 = (wxClassInfo *)sm_classTable->Get(info->GetBaseClassName1()); - if (info->GetBaseClassName2()) - info->m_baseInfo2 = (wxClassInfo *)sm_classTable->Get(info->GetBaseClassName2()); + info->m_baseInfo1 = GetBaseByName(info->GetBaseClassName1()); + info->m_baseInfo2 = GetBaseByName(info->GetBaseClassName2()); } }