Changeset 202736 in webkit
- Timestamp:
- Jul 1, 2016 8:40:39 AM (8 years ago)
- Location:
- trunk/Source/WTF
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r202642 r202736 1 2016-07-01 Jer Noble <jer.noble@apple.com> 2 3 Deadlock inside -[WebCoreNSURLSession dealloc] 4 https://bugs.webkit.org/show_bug.cgi?id=159331 5 <rdar://problem/27122716> 6 7 Reviewed by Alex Christensen. 8 9 A Function<> object can wrap any callable type, including a C++ lambda. 10 11 dispatchFunctionsFromMainThread() holds a lock while iterating over the functions in 12 functionQueue(), and during ths iteration, the previous callable object is destroyed by 13 assigning the result of functionQueue().takeFirst(). Because lambdas (and other callables, 14 like functors) can own objects, destroying this callable can have side effects, and if one 15 of those side effects is to call callOnMainThread(), this can deadlock. 16 17 Move this side-effect-having call outside the locked block by clearing the function object 18 immediately after calling it. 19 20 * wtf/MainThread.cpp: 21 (WTF::dispatchFunctionsFromMainThread): 22 1 23 2016-06-29 Jer Noble <jer.noble@apple.com> 2 24 -
trunk/Source/WTF/wtf/MainThread.cpp
r202439 r202736 134 134 function(); 135 135 136 // Clearing the function can have side effects, so do so outside of the lock above. 137 function = nullptr; 138 136 139 // If we are running accumulated functions for too long so UI may become unresponsive, we need to 137 140 // yield so the user input can be processed. Otherwise user may not be able to even close the window.
Note: See TracChangeset
for help on using the changeset viewer.