mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-11 01:01:25 +03:00
Fix rare crash when invalidating widgets.
This commit is contained in:
@@ -81,10 +81,6 @@ unsigned long ClockImpl::getElapsedTime() {
|
||||
return newMicro;
|
||||
}
|
||||
|
||||
bool ClockImpl::isPO2( Uint32 n ) {
|
||||
return ( n & ( n - 1 ) ) == 0;
|
||||
}
|
||||
|
||||
}}} // namespace EE::System::Platform
|
||||
|
||||
#endif
|
||||
|
||||
@@ -33,9 +33,8 @@ class ClockImpl {
|
||||
LARGE_INTEGER mStartTime;
|
||||
LARGE_INTEGER mFrequency;
|
||||
unsigned long mTimerMask;
|
||||
|
||||
bool isPO2( Uint32 n );
|
||||
};
|
||||
|
||||
}}} // namespace EE::System::Platform
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,6 +16,11 @@ ModelIndex ModelIndex::siblingAtColumn( int column ) const {
|
||||
return sibling( row(), column );
|
||||
}
|
||||
|
||||
std::string ModelIndex::toString() const {
|
||||
return String::format( "ModelIndex{col: %ld - row: %ld, internalId: %ld}", mColumn, mRow,
|
||||
mInternalId );
|
||||
}
|
||||
|
||||
Variant ModelIndex::data( ModelRole role ) const {
|
||||
if ( !isValid() )
|
||||
return {};
|
||||
|
||||
@@ -664,14 +664,18 @@ UIWidget* UISceneNode::getRoot() const {
|
||||
return mRoot;
|
||||
}
|
||||
|
||||
void UISceneNode::invalidateStyle( UIWidget* node ) {
|
||||
void UISceneNode::invalidateStyle( UIWidget* node, bool tryReinsert ) {
|
||||
eeASSERT( NULL != node );
|
||||
|
||||
if ( node->isClosing() )
|
||||
return;
|
||||
|
||||
if ( mDirtyStyle.count( node ) > 0 )
|
||||
return;
|
||||
if ( mDirtyStyle.count( node ) > 0 ) {
|
||||
if ( !tryReinsert )
|
||||
return;
|
||||
else
|
||||
mDirtyStyle.erase( node );
|
||||
}
|
||||
|
||||
for ( auto& dirtyNode : mDirtyStyle )
|
||||
if ( NULL != dirtyNode && dirtyNode->isParentOf( node ) )
|
||||
@@ -689,14 +693,19 @@ void UISceneNode::invalidateStyle( UIWidget* node ) {
|
||||
mDirtyStyle.insert( node );
|
||||
}
|
||||
|
||||
void UISceneNode::invalidateStyleState( UIWidget* node, bool disableCSSAnimations ) {
|
||||
void UISceneNode::invalidateStyleState( UIWidget* node, bool disableCSSAnimations,
|
||||
bool tryReinsert ) {
|
||||
eeASSERT( NULL != node );
|
||||
|
||||
if ( node->isClosing() )
|
||||
return;
|
||||
|
||||
if ( mDirtyStyleState.count( node ) > 0 )
|
||||
return;
|
||||
if ( mDirtyStyleState.count( node ) > 0 ) {
|
||||
if ( !tryReinsert )
|
||||
return;
|
||||
else
|
||||
mDirtyStyleState.erase( node );
|
||||
}
|
||||
|
||||
for ( auto& dirtyNode : mDirtyStyleState )
|
||||
if ( NULL != dirtyNode && dirtyNode->isParentOf( node ) )
|
||||
|
||||
@@ -994,8 +994,8 @@ void UIWidget::onThemeLoaded() {}
|
||||
|
||||
void UIWidget::onParentChange() {
|
||||
if ( !isSceneNodeLoading() && !isLoadingState() ) {
|
||||
getUISceneNode()->invalidateStyle( this );
|
||||
getUISceneNode()->invalidateStyleState( this, true );
|
||||
getUISceneNode()->invalidateStyle( this, true );
|
||||
getUISceneNode()->invalidateStyleState( this, true, true );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user