RESOLVED FIXED 95118
Hook procedure should check to see if hook has already been removed before attempting removal.
https://bugs.webkit.org/show_bug.cgi?id=95118
Summary Hook procedure should check to see if hook has already been removed before at...
Roger Fong
Reported 2012-08-27 13:19:27 PDT
When the hookFired method in LayerChangesFlusher.cpp gets called it calls CallNextHook to pass the message to the next hook procedure in the hook chain. However, sometimes, the hook procedure it gets passed to can dispatch another message that goes back through the hook chain and causes the hookFired method to get called again (before returning from CallNextHookEx). When the second hookFired call completes, it can remove the hook. When CallNextHook returns the original call to hookFired may try to remove the hook as well. However, there is no need as the hook as already been removed and in fact we get an assertion failure assert(m_hook) when we try to call removeHook(). The fix is simply to check to see that m_hook is not null before calling into removeHook, so we don't waste effort trying to remove a hook that has already been removed. Alternatively, I could just remove the assert but then just call UnhookWindowHookEx regardless of whether the hook has already been removed or not, but that seems a little sketchy to me...
Attachments
patch (2.02 KB, patch)
2012-08-27 13:46 PDT, Roger Fong
no flags
typo in Changelog (2.02 KB, patch)
2012-08-27 13:54 PDT, Roger Fong
simon.fraser: review+
more typos/clarification (2.20 KB, patch)
2012-08-27 14:16 PDT, Roger Fong
no flags
Radar WebKit Bug Importer
Comment 1 2012-08-27 13:20:12 PDT
Roger Fong
Comment 2 2012-08-27 13:28:51 PDT
> However, sometimes, the hook procedure it gets passed to can dispatch another message that goes back through the hook chain and causes the hookFired method to get called again (before returning from CallNextHookEx). I think I missed half a sentence...: Sometimes, the hook procedure can passed to another hook procedure that can dispatch another message. This message goes back through the hook chain and causes the hookFired method to get called again (before returning from CallNextHookEx).
Roger Fong
Comment 3 2012-08-27 13:46:40 PDT
Roger Fong
Comment 4 2012-08-27 13:54:33 PDT
Created attachment 160798 [details] typo in Changelog
Simon Fraser (smfr)
Comment 5 2012-08-27 13:55:28 PDT
Comment on attachment 160798 [details] typo in Changelog View in context: https://bugs.webkit.org/attachment.cgi?id=160798&action=review > Source/WebCore/ChangeLog:8 > + Sometimes, the hook procedure can passed to another hook procedure that can dispatch another message. "can passed to"? > Source/WebCore/ChangeLog:9 > + This message goes back through the hook chain and causes the hookFired method to get called again Are you saying that it can re-enter?
Roger Fong
Comment 6 2012-08-27 14:16:55 PDT
Created attachment 160803 [details] more typos/clarification
WebKit Review Bot
Comment 7 2012-08-27 15:18:43 PDT
Comment on attachment 160803 [details] more typos/clarification Clearing flags on attachment: 160803 Committed r126805: <http://trac.webkit.org/changeset/126805>
WebKit Review Bot
Comment 8 2012-08-27 15:18:47 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.