-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Description
Please include the following in your bug report:
Version of emscripten/emsdk:
Please include the output emcc -v here
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.51 (c0c2ca1)
clang version 18.0.0git (https://github.com/llvm/llvm-project f2464ca317bfeeedddb7cbdea3c2c8ec487890bb)
Target: wasm32-unknown-emscripten
Thread model: posix
Build command line:
emcc --bind --profiling -g -sASSERTIONS=2
-sSHARED_MEMORY
-s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1
-L/J/FFMPEG_SRC/FFmpeg/testcpp/libs/ffmpeg/lib
-I/J/FFMPEG_SRC/FFmpeg/testcpp/libs/ffmpeg/include
-s EXPORTED_RUNTIME_METHODS="[FS, cwrap, ccall, getValue, setValue, writeAsciiToMemory, run]"
-lx264 -lx265 -lvpx -lmp3lame -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lopus -lz -lwebp -lfreetype -lfribidi -lharfbuzz -lass -lzimg -lm
-lavcodec -lavfilter -lavformat -lavutil -lswresample -lswscale
-Wno-deprecated-declarations
-sWASM_BIGINT
-sUSE_SDL=2
-sINITIAL_MEMORY=32MB -sALLOW_MEMORY_GROWTH
-s USE_PTHREADS=1 -sPTHREAD_POOL_SIZE=4 -sPTHREAD_POOL_SIZE_STRICT=2 -sSTACK_OVERFLOW_CHECK=2
-o www/mp4info.js
mp4info-wrapper.cpp
** The Issue **
I'm using SDL2 to output a frame to a texture.
Now it seems like emscripten checks events with Event.detail which is fine for MouseEvents and other usual events.
But if you resize the window it will trigger the function with a Event that doesn't have a detail member causing an error a detail is undefined:
** UIEventHandlerFunc **
var uiEvent = targetThread ? _malloc(36) : JSEvents.uiEvent;
GROWABLE_HEAP_I32()[((uiEvent) >> 2)] = e.detail; // <-------------- Another access
checkInt32(e.detail); // <-------------- Here is the access
GROWABLE_HEAP_I32()[(((uiEvent) + (4)) >> 2)] = b.clientWidth;
checkInt32(b.clientWidth);
GROWABLE_HEAP_I32()[(((uiEvent) + (8)) >> 2)] = b.clientHeight;
checkInt32(b.clientHeight);** Handler func **
var jsEventHandler = function jsEventHandler(event) {
++JSEvents.inEventHandler;
JSEvents.currentEventHandler = eventHandler;
JSEvents.runDeferredCalls();
eventHandler.handlerFunc(event); // < ----------------------------- The error is here as the event resize doesn't have detail
JSEvents.runDeferredCalls();
--JSEvents.inEventHandler;
};
if (eventHandler.callbackfunc) {
eventHandler.eventListenerFunc = jsEventHandler;
eventHandler.target.addEventListener(eventHandler.eventTypeString, jsEventHandler, eventHandler.useCapture);
JSEvents.eventHandlers.push(eventHandler);
JSEvents.registerRemoveEventListeners();