Bug 131528

Summary: [Mac] Prevent crash when exiting fullscreen mode
Product: WebKit Reporter: Brent Fulgham <bfulgham>
Component: WebKit2Assignee: Brent Fulgham <bfulgham>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, bfulgham, jer.noble
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
I think this resolves the 'real' problem jer.noble: review+

Description Brent Fulgham 2014-04-10 22:04:28 PDT
It is possible to cause a crash in WebKit if you enter full screen mode, exit full screen mode, and close the main view quickly enough.

The crash is due to an animation thread attempting to interact with a deallocated window. When we decide to rapidly terminate a window, we need to tell any existing animation controllers to stop animating, and clear their window references.
Comment 1 Brent Fulgham 2014-04-10 22:06:58 PDT
Created attachment 229107 [details]
Patch
Comment 2 Brent Fulgham 2014-04-10 22:07:20 PDT
<rdar://problem/13967272>
Comment 3 Jer Noble 2014-04-10 22:44:52 PDT
Comment on attachment 229107 [details]
Patch

Nice! r=me.
Comment 4 Brent Fulgham 2014-04-11 09:13:51 PDT
Created attachment 229138 [details]
I think this resolves the 'real' problem
Comment 5 Brent Fulgham 2014-04-11 09:15:58 PDT
It was bothering me that we were entering the WKFullScreenWindowController::close method with _fullScreenState != ExitingFullScreen, but _scaleAnimation still non-nil and running an animation.

I think the actual fix need to be done 'finishedExitFullScreenAnimation', where we clean up the _fadeAnimation, but don't touch the _scaleAnimation.

I still like the initial fix to protect us against leaving a running animation when the window is going away, but I think the 'real' fix is this second patch.
Comment 6 Brent Fulgham 2014-04-11 09:16:58 PDT
Comment on attachment 229138 [details]
I think this resolves the 'real' problem

Updated patch that makes sure we never are in a state where '_fullScreenState != ExitingFullScreen' while we have a running animation.
Comment 7 Jer Noble 2014-04-11 09:51:27 PDT
Comment on attachment 229138 [details]
I think this resolves the 'real' problem

re-r=me.
Comment 8 Brent Fulgham 2014-04-11 09:52:15 PDT
Committed r167130: <http://trac.webkit.org/changeset/167130>