WebKit may crash when calling -[PlatformCAAnimationRemote animationDidStop] if the PlatformCAAnimationRemote's layer tree host has been deallocated.
<rdar://problem/21609257>
Reproducible nearly 100% of the time -- visit http://whsieh.github.io/examples/layerhost-crash.html and click the link. Works best when running an iOS simulator on a debug build where you can see the stack trace upon the crash.
Created attachment 259975 [details] Test case that reproduces the bug Click the link to open a new tab. The new tab will crash while exiting.
Created attachment 259977 [details] Patch
Comment on attachment 259977 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=259977&action=review > Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm:145 > m_layers.remove(layerID); 1) You can do the hash table lookup only once. 2) Should you also cover the case in clearLayers()?
Comment on attachment 259977 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=259977&action=review >> Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm:145 >> m_layers.remove(layerID); > > 1) You can do the hash table lookup only once. > > 2) Should you also cover the case in clearLayers()? 1. Good point. Fixed. 2. clearLayers is only invoked in the destructor of RemoteLayerTreeHost, which ensures that all animation delegates are first invalidated. It might be better to lift the invalidation logic from ~RemoteLayerTreeHost to clearLayers() instead though.
(In reply to comment #6) > Comment on attachment 259977 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=259977&action=review > > >> Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm:145 > >> m_layers.remove(layerID); > > > > 1) You can do the hash table lookup only once. > > > > 2) Should you also cover the case in clearLayers()? > > 1. Good point. Fixed. > > 2. clearLayers is only invoked in the destructor of RemoteLayerTreeHost, > which ensures that all animation delegates are first invalidated. It might > be better to lift the invalidation logic from ~RemoteLayerTreeHost to > clearLayers() instead though. Ah! No, that's probably fine. OK.
Created attachment 259980 [details] Patch
Please consider making your test a layout test (it seems like a pretty easy one).
Comment on attachment 259980 [details] Patch Clearing flags on attachment: 259980 Committed r188991: <http://trac.webkit.org/changeset/188991>
All reviewed patches have been landed. Closing bug.