Closed Bug 1289716 Opened 9 years ago Closed 6 years ago

Hold WebGLContext in WebGLExtensionLoseContext extension

Categories

(Core :: Graphics: CanvasWebGL, task, P3)

task

Tracking

()

RESOLVED INVALID

People

(Reporter: jerry, Assigned: jerry)

Details

(Whiteboard: gfx-noted)

Attachments

(1 file)

Gecko doesn't detach the WebGLExtensionLoseContext extension when the context lost[1], so it might be possible that we use the WebGLExtensionLoseContext js object while the webglContext is gone. I'm trying to hold one webglContext ref-count inside WebGLExtensionLoseContext to prevent that situation. [1] https://hg.mozilla.org/mozilla-central/annotate/ceb63dec9267e9bb62f5e5e1f4c9d32d3ac1fbac/dom/canvas/WebGLContext.cpp#l296
Priority: -- → P3
Whiteboard: gfx-noted
Comment on attachment 8799623 [details] [diff] [review] hold WebGLContext in WebGLExtensionLoseContext extension. v1 Review of attachment 8799623 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/canvas/WebGLExtensions.h @@ +194,5 @@ > + // "WEBGL_lose_context". The WebGLExtensionLoseContext js object might be > + // used while the WebGLContext is gone. Hold one webglContext ref-count here > + // to prevent this situation. > + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2 > + RefPtr<WebGLContext> mWebGLContext; If we have an WebGLExtensionLoseContext obj, the WebGLContext might be released after ~WebGLExtensionLoseContext. WebGLContext doesn't have the WebGLExtensionLoseContext ref-count. So, there is no reference cycle between these two object.
Comment on attachment 8799623 [details] [diff] [review] hold WebGLContext in WebGLExtensionLoseContext extension. v1 Review of attachment 8799623 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/canvas/WebGLExtensions.h @@ +194,5 @@ > + // "WEBGL_lose_context". The WebGLExtensionLoseContext js object might be > + // used while the WebGLContext is gone. Hold one webglContext ref-count here > + // to prevent this situation. > + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2 > + RefPtr<WebGLContext> mWebGLContext; WebGLContext::mExtensions holds a refcount to WebGLExtensionLoseContext. Use a weak pointer in this case.
Attachment #8799623 - Flags: review?(jgilbert) → review-

We don't actually want a strong-ref there.

Status: ASSIGNED → RESOLVED
Type: defect → task
Closed: 6 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: