Reintroduce PassRefPtr<Event> copy in ScopedEventQueue::dispatchEvent
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Oct 2013 15:45:35 +0000 (15:45 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Oct 2013 15:45:35 +0000 (15:45 +0000)
commitfde94f85a7e7a2bd8ada37249fe4502bfecedfc9
treef9f1351cf028cbfb70517d29dd6d8affce460609
parent3d892a6d08fdd3a8b0365bc5b45907769f7f52f8
Reintroduce PassRefPtr<Event> copy in ScopedEventQueue::dispatchEvent
https://bugs.webkit.org/show_bug.cgi?id=122742

Reviewed by Alexey Proskuryakov.

This is a follow-up to r157219 which introduced a workaround for the GCC's quirky behavior that
was resulting in crashes due to the PassRefPtr<Event> object passed to EventDispatcher::dispatchEvent
being copied and nullified first before retrieving the EventTarget of the Event object wrapped in that
PassRefPtr.

The implementation is now adjusted to first retrieve the pointer to the Event's EventTarget and store
it in a local variable. That variable is then passed as the first parameter to EventDispatcher::dispatchEvent,
and the PassRefPtr<Event> passed directly as the second parameter. Previously the pointer of that PassRefPtr
object was passed in, with a new PassRefPtr being created which would increase the reference count of the
ref-counted object. Passing in the original PassRefPtr avoids the unnecessary reference count increase by creating
a copy. That still nullifies the original PassRefPtr, but that's not a problem anymore.

* dom/ScopedEventQueue.cpp:
(WebCore::ScopedEventQueue::dispatchEvent):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@157401 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/dom/ScopedEventQueue.cpp