mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-01-03 11:44:46 +00:00
Fixes a deadlock caused by walking up the heirarchy. (#2147)
* Fixes a deadlock caused by walking up the heirarchy. * Use scope locker / unlocker and add a comment. * Add comment about calling __setNeedsLayout without the lock.
This commit is contained in:
committed by
Adlai Holler
parent
e6e5c346de
commit
8032758176
@@ -1182,6 +1182,9 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
||||
// but automatic subnode management would require us to modify the node tree
|
||||
// in the background on a loaded node, which isn't currently supported.
|
||||
if (_pendingViewState.hasSetNeedsLayout) {
|
||||
//Need to unlock before calling setNeedsLayout to avoid deadlocks.
|
||||
//MutexUnlocker will re-lock at the end of scope.
|
||||
ASDN::MutexUnlocker u(__instanceLock__);
|
||||
[self __setNeedsLayout];
|
||||
}
|
||||
|
||||
@@ -1213,6 +1216,7 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
||||
[self displayImmediately];
|
||||
}
|
||||
|
||||
//Calling this with the lock held can lead to deadlocks. Always call *unlocked*
|
||||
- (void)__setNeedsLayout
|
||||
{
|
||||
ASDisplayNodeAssertThreadAffinity(self);
|
||||
|
||||
Reference in New Issue
Block a user