Bug 210222 - Clean up more resources during WebGLLayer teardown
Summary: Clean up more resources during WebGLLayer teardown
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kenneth Russell
URL:
Keywords: InRadar
Depends on: 210213
Blocks: 210153
  Show dependency treegraph
 
Reported: 2020-04-08 15:55 PDT by Kenneth Russell
Modified: 2020-04-14 09:04 PDT (History)
8 users (show)

See Also:


Attachments
Patch (3.18 KB, patch)
2020-04-13 16:09 PDT, Kenneth Russell
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kenneth Russell 2020-04-08 15:55:28 PDT
Examining the WebGLLayer cleanup code for the USE(ANGLE) path, it looks like textures can still be bound to IOSurfaces at the time the WebGLLayer is destroyed. Since the OpenGL context (provided via ANGLE) is going to be destroyed, it seems most prudent to unbind those textures if necessary, and delete them, in [WebGLLayer -dealloc].
Comment 1 Kenneth Russell 2020-04-13 16:08:34 PDT
Doing this work in -dealloc: turns out to not be a good idea. It looks like (from Bug 210213) the WebGLLayer is likely retained by the CALayer tree, so its lifetime is much longer than the GraphicsContextGL. There's a specific point just before deletion of the GraphicsContextGL's native context where these resources should be released.
Comment 2 Kenneth Russell 2020-04-13 16:09:47 PDT
Created attachment 396351 [details]
Patch
Comment 3 EWS 2020-04-13 16:42:52 PDT
Committed r260049: <https://trac.webkit.org/changeset/260049>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 396351 [details].
Comment 4 Radar WebKit Bug Importer 2020-04-13 16:43:13 PDT
<rdar://problem/61745462>
Comment 5 Kenneth Russell 2020-04-13 17:21:35 PDT
+ryanhaddad@ who found the crashers previously from the fix for Bug 210213 - hope that this patch doesn't cause similar issues. Please revert if it does; thanks.
Comment 6 Ryan Haddad 2020-04-14 09:04:37 PDT
(In reply to Kenneth Russell from comment #5)
> +ryanhaddad@ who found the crashers previously from the fix for Bug 210213 -
> hope that this patch doesn't cause similar issues. Please revert if it does;
> thanks.
Thanks for the heads up!