diff options
Diffstat (limited to 'results/scraper/fex/2189')
| -rw-r--r-- | results/scraper/fex/2189 | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/results/scraper/fex/2189 b/results/scraper/fex/2189 new file mode 100644 index 000000000..9064f0c9f --- /dev/null +++ b/results/scraper/fex/2189 @@ -0,0 +1,54 @@ +How can I fix crashed In XSetErrorHandler? +source code: +https://github.com/opengl-tutorials/ogl + +how to reproduce: +1. open -DBUILD_THUNKS, build FEXLoader +2. run tutorial01_first_window +3. FEXLoader crashed + +Guest Code error position: ogl/external/glfw-3.1.2/src/x11_init.c:680, XSetErrorHandler +``` +void _glfwReleaseXErrorHandler(void) +{ + // Synchronize to make sure all commands are processed + XSync(_glfw.x11.display, False); + XSetErrorHandler(NULL); +} +``` + +FEXLoader Crash position: Thunks.cpp:436, FinalizeHostTrampolineForGuestFunction +``` + FEX_DEFAULT_VISIBILITY + void FinalizeHostTrampolineForGuestFunction(HostToGuestTrampolinePtr* TrampolineAddress, void* HostPacker) { + auto& Trampoline = GetInstanceInfo(TrampolineAddress); + + LOGMAN_THROW_A_FMT(Trampoline.CallCallback == (uintptr_t)&ThunkHandler_impl::CallCallback, + "Invalid trampoline at {} passed to {}", fmt::ptr(TrampolineAddress), __FUNCTION__); + + if (!Trampoline.HostPacker) { + LogMan::Msg::DFmt("Thunks: Finalizing trampoline at {} with host packer {}", fmt::ptr(TrampolineAddress), fmt::ptr(HostPacker)); + Trampoline.HostPacker = HostPacker; + } + } +``` + +It seems when I pass a callback ptr is NULL to XSetErrorHandler, TrampolineAddress is NULL too, so GetInstanceInfo return error info. and LOGMAN_THROW_A_FMT thow a exception. + +so is it right to fix this problem like this, immediate return when TrampolineAddress is NULL: +``` + FEX_DEFAULT_VISIBILITY + void FinalizeHostTrampolineForGuestFunction(HostToGuestTrampolinePtr* TrampolineAddress, void* HostPacker) { + if (TrampolineAddress == nullptr) return; + + auto& Trampoline = GetInstanceInfo(TrampolineAddress); + + LOGMAN_THROW_A_FMT(Trampoline.CallCallback == (uintptr_t)&ThunkHandler_impl::CallCallback, + "Invalid trampoline at {} passed to {}", fmt::ptr(TrampolineAddress), __FUNCTION__); + + if (!Trampoline.HostPacker) { + LogMan::Msg::DFmt("Thunks: Finalizing trampoline at {} with host packer {}", fmt::ptr(TrampolineAddress), fmt::ptr(HostPacker)); + Trampoline.HostPacker = HostPacker; + } + } +``` |