mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-02 04:38:33 +00:00
Fix race in ASDisplayNodeRespectThreadAffinityOfNode
This commit is contained in:
parent
6275219f79
commit
c26e9c7e94
@ -71,12 +71,16 @@ void ASDisplayNodeRespectThreadAffinityOfNode(ASDisplayNode *node, void (^block)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node.nodeLoaded) {
|
{
|
||||||
ASDisplayNodePerformBlockOnMainThread(^{
|
// Hold the lock to avoid a race where the node gets loaded while the block is in-flight.
|
||||||
|
ASDN::MutexLocker l(node->_propertyLock);
|
||||||
|
if (node.nodeLoaded) {
|
||||||
|
ASDisplayNodePerformBlockOnMainThread(^{
|
||||||
|
block();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
block();
|
block();
|
||||||
});
|
}
|
||||||
} else {
|
|
||||||
block();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user