mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-29 03:21:29 +00:00
Fix race in ASDisplayNodeRespectThreadAffinityOfNode
This commit is contained in:
parent
6275219f79
commit
c26e9c7e94
@ -71,6 +71,9 @@ void ASDisplayNodeRespectThreadAffinityOfNode(ASDisplayNode *node, void (^block)
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
// 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();
|
||||
@ -79,6 +82,7 @@ void ASDisplayNodeRespectThreadAffinityOfNode(ASDisplayNode *node, void (^block)
|
||||
block();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user