Skip to content

Commit f53a92d

Browse files
committed
Alternative for commit 507b455
1 parent 12058a1 commit f53a92d

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/lib/libhtml5_webgl.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,12 @@ var LibraryHtml5WebGL = {
331331
},
332332

333333
emscripten_webgl_destroy_context__proxy: 'sync_on_webgl_context_handle_thread',
334-
emscripten_webgl_destroy_context__deps: ['free'],
334+
emscripten_webgl_destroy_context__deps: ['free', '$JSEvents'],
335335
emscripten_webgl_destroy_context: (contextHandle) => {
336336
if (GL.currentContext == contextHandle) GL.currentContext = 0;
337+
// Release all JS event handlers on the DOM element that the GL context is
338+
// associated with since the context is now deleted.
339+
JSEvents.removeAllHandlersOnTarget(GL.contexts[contextHandle].GLctx.canvas);
337340
GL.deleteContext(contextHandle);
338341
},
339342

src/lib/libwebgl.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,13 +1179,6 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
11791179
if (GL.currentContext === GL.contexts[contextHandle]) {
11801180
GL.currentContext = null;
11811181
}
1182-
#if !MINIMAL_RUNTIME
1183-
if (typeof JSEvents == 'object') {
1184-
// Release all JS event handlers on the DOM element that the GL context is
1185-
// associated with since the context is now deleted.
1186-
JSEvents.removeAllHandlersOnTarget(GL.contexts[contextHandle].GLctx.canvas);
1187-
}
1188-
#endif
11891182
// Make sure the canvas object no longer refers to the context object so
11901183
// there are no GC surprises.
11911184
if (GL.contexts[contextHandle]?.GLctx.canvas) {

0 commit comments

Comments
 (0)