Work around an apparent gcc optimizer bug in wxClassInfo
Rewrite a complex expression in wxClassInfo::IsKindOf() as several statements to avoid what looks like a gcc optimizer bug as it was dereferencing m_baseInfo1 pointer even when it was null. The new version is not completely equivalent to the old one as it doesn't check for info == NULL which is not really necessary, but this is just a side effect and doesn't affect anything, the important change is avoiding doing everything in a single expression. Closes #17483.
This commit is contained in:
@@ -85,10 +85,22 @@ public:
|
|||||||
|
|
||||||
bool IsKindOf(const wxClassInfo *info) const
|
bool IsKindOf(const wxClassInfo *info) const
|
||||||
{
|
{
|
||||||
return info != 0 &&
|
if ( info == this )
|
||||||
( info == this ||
|
return true;
|
||||||
( m_baseInfo1 && m_baseInfo1->IsKindOf(info) ) ||
|
|
||||||
( m_baseInfo2 && m_baseInfo2->IsKindOf(info) ) );
|
if ( m_baseInfo1 )
|
||||||
|
{
|
||||||
|
if ( m_baseInfo1->IsKindOf(info) )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( m_baseInfo2 )
|
||||||
|
{
|
||||||
|
if ( m_baseInfo2->IsKindOf(info) )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDECLARE_CLASS_INFO_ITERATORS();
|
wxDECLARE_CLASS_INFO_ITERATORS();
|
||||||
|
Reference in New Issue
Block a user