Changeset 198335 in webkit
- Timestamp:
- Mar 17, 2016, 10:02:14 AM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r198334 r198335 1 2016-03-17 Antti Koivisto <antti@apple.com> 2 3 DataURLDecoder::DecodingResultDispatcher may get deleted outside main thread 4 https://bugs.webkit.org/show_bug.cgi?id=155584 5 rdar://problem/24492104 6 7 Reviewed by Chris Dumez. 8 9 This is unsafe as it owns strings and other types that are only safe to delete in the main thread. 10 11 * platform/network/DataURLDecoder.cpp: 12 (WebCore::DataURLDecoder::DecodingResultDispatcher::dispatch): 13 14 The problem is that this was a refcounted type. This created a race. If the timer fired before dispatch() 15 was exited the implicit deref here would trigger the deletion in the dispatching thread. 16 17 Fix by getting rid of the unnecessary refcounting. Timer firing will now delete the instance explicitly. 18 19 (WebCore::DataURLDecoder::DecodingResultDispatcher::startTimer): 20 (WebCore::DataURLDecoder::DecodingResultDispatcher::timerFired): 21 1 22 2016-03-17 Commit Queue <commit-queue@webkit.org> 2 23 -
trunk/Source/WebCore/platform/network/DataURLDecoder.cpp
r195694 r198335 57 57 #if HAVE(RUNLOOP_TIMER) 58 58 59 class DecodingResultDispatcher : public ThreadSafeRefCounted<DecodingResultDispatcher> { 59 class DecodingResultDispatcher { 60 WTF_MAKE_FAST_ALLOCATED; 60 61 public: 61 62 static void dispatch(std::unique_ptr<DecodeTask> decodeTask) 62 63 { 63 Ref<DecodingResultDispatcher> dispatcher = adoptRef(*new DecodingResultDispatcher(WTFMove(decodeTask)));64 auto* dispatcher = new DecodingResultDispatcher(WTFMove(decodeTask)); 64 65 dispatcher->startTimer(); 65 66 } … … 74 75 void startTimer() 75 76 { 76 // Keep alive until the timer has fired.77 ref();78 77 m_timer.startOneShot(0); 79 78 m_timer.schedule(m_decodeTask->scheduleContext.scheduledPairs); … … 87 86 m_decodeTask->completionHandler({ }); 88 87 89 de ref();88 delete this; 90 89 } 91 90
Note:
See TracChangeset
for help on using the changeset viewer.