Skip to content

Conversation

@ypujante
Copy link
Contributor

I just pushed a new version with the following release notes:

  • Fixed #24: glfwMakeContextCurrent non-compliance
  • Use emscripten_html5_remove_event_listener which makes the library safer to use (it no longer iterferes with the client code). Note that the client should also use emscripten_html5_remove_event_listener in order not to interfere with the library.

@sbc100 This new version in particular contains the changes to use the newly introduced emscripten_html5_remove_event_listener. The demo/test program has been updated to demonstrate that the library is doing the "right" thing, meaning NOT interfering with the handlers set by the client code and also removing all its handlers on exit (this is how I found out that there was an issue with one of the listeners setting 2 listeners for Safari).

This is an output that demonstrates the test:

Before glfwInit() | Event Handlers = 0 main.js:104:150
After glfwInit() | Event Handlers = 12 main.js:104:150
GLFW: 3.4.0 | Emscripten | pongasoft/emscripten-glfw@v3.4.0.20251217-nw | Platform: 0x60006 main.js:67:481
emscripten: v4.0.21 main.js:67:481
After glfwCreateWindow(window1) | Event Handlers = 19 main.js:104:150
After glfwCreateWindow(window2) | Event Handlers = 26 main.js:104:150
canvas1 | WebGL: OpenGL ES 3.0 (WebGL 2.0) | Apple M1, or similar main.js:67:481
canvas2 | WebGL: OpenGL ES 3.0 (WebGL 2.0) | Apple M1, or similar main.js:67:481
After adding application event listener | Event Handlers = 27 main.js:104:150
After glfwDestroyWindow(canvas2) | Event Handlers = 20 main.js:104:150
After glfwDestroyWindow(canvas1) | Event Handlers = 13 main.js:104:150
After glfwTerminate() | Event Handlers = 1 main.js:104:150
After removing application event listener | Event Handlers = 0 main.js:104:150

@sbc100 sbc100 enabled auto-merge (squash) December 17, 2025 18:34
@ypujante
Copy link
Contributor Author

This is the only failing test, which is clearly unrelated to my changes:

======================================================================
FAIL [0.001s]: test_audio_worklet_closure (test_browser.browser_2gb)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/project/test/common.py", line 295, in resulting_test
    return func(self, *args)
  File "/root/project/test/test_browser.py", line 225, in decorated
    f(self, *args, **kwargs)
  File "/root/project/test/test_browser.py", line 225, in decorated
    f(self, *args, **kwargs)
  File "/root/project/test/test_browser.py", line 225, in decorated
    f(self, *args, **kwargs)
  File "/root/project/test/test_browser.py", line 5431, in test_audio_worklet
    self.btest_exit('webaudio/audioworklet.c', cflags=['-sAUDIO_WORKLET', '-sWASM_WORKERS', '-DTEST_AND_EXIT'] + args)
  File "/root/project/test/browser_common.py", line 904, in btest_exit
    return self.btest(filename, *args, **kwargs)
  File "/root/project/test/browser_common.py", line 945, in btest
    self.run_browser(html_file, expected=['/report_result?' + e for e in expected], timeout=timeout)
  File "/root/project/test/browser_common.py", line 857, in run_browser
    raise e
  File "/root/project/test/browser_common.py", line 848, in run_browser
    self.assertContained(expected, output)
  File "/root/project/test/common.py", line 1073, in assertContained
    self.fail("Expected to find '%s' in '%s', diff:\n\n%s\n%s" % (
AssertionError: Expected to find '/report_result?exit:0
' in '[no http server activity]
', diff:

--- expected
+++ actual
@@ -1 +1 @@
-/report_result?exit:0
+[no http server activity]

@sbc100 sbc100 disabled auto-merge December 17, 2025 19:58
@sbc100 sbc100 merged commit 7a58731 into emscripten-core:main Dec 17, 2025
33 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

glfwMakeContextCurrent(nullptr) emits an error instead of detaching context

2 participants