Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Segfault when using with GLFW.jl. #3

Open
dylanxyz opened this issue Dec 3, 2022 · 2 comments
Open

Segfault when using with GLFW.jl. #3

dylanxyz opened this issue Dec 3, 2022 · 2 comments

Comments

@dylanxyz
Copy link

dylanxyz commented Dec 3, 2022

When trying to use this package with GLFW.jl, i get a segfault if there are previous user callbacks setted using GLFW.jl.

The segfault outputs:

Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x5ca588e4 -- getindex at .\array.jl:924 [inlined]
_CursorPosCallbackWrapper at C:\Users\dylanxyz\.julia\packages\GLFW\BWxfF\src\callback.jl:43
in expression starting at C:\Users\dylanxyz\dev\TelaUI\examples\demo.jl:15
getindex at .\array.jl:924 [inlined]
_CursorPosCallbackWrapper at C:\Users\dylanxyz\.julia\packages\GLFW\BWxfF\src\callback.jl:43
unknown function (ip: 000000005ca5fbe3)
windowProc at C:\Users\dylanxyz\.julia\artifacts\09afce8db647ca1b603103c82397809ce7189340\bin\glfw3.dll (unknown line)
DispatchMessageW at C:\Windows\System32\USER32.dll (unknown line)
CallWindowProcW at C:\Windows\System32\USER32.dll (unknown line)
wglSwapBuffers at C:\Windows\SYSTEM32\OPENGL32.dll (unknown line)
DispatchMessageW at C:\Windows\System32\USER32.dll (unknown line)
DispatchMessageW at C:\Windows\System32\USER32.dll (unknown line)
_glfwPlatformPollEvents at C:\Users\dylanxyz\.julia\artifacts\09afce8db647ca1b603103c82397809ce7189340\bin\glfw3.dll (unknown line)
PollEvents at C:\Users\dylanxyz\.julia\packages\GLFW\BWxfF\src\glfw3.jl:620 [inlined]
wait at C:\Users\dylanxyz\.julia\packages\Tela\A9crs\src\window.jl:30 [inlined]
start at C:\Users\dylanxyz\.julia\packages\Tela\A9crs\src\app.jl:53
run at C:\Users\dylanxyz\.julia\packages\Tela\A9crs\src\Tela.jl:130
run at C:\Users\dylanxyz\.julia\packages\Tela\A9crs\src\Tela.jl:124
unknown function (ip: 000000005ca627d6)
jl_apply at /cygdrive/c/buildbot/worker/package_win64/build/src\julia.h:1839 [inlined]
do_call at /cygdrive/c/buildbot/worker/package_win64/build/src\interpreter.c:126
eval_value at /cygdrive/c/buildbot/worker/package_win64/build/src\interpreter.c:215
eval_stmt_value at /cygdrive/c/buildbot/worker/package_win64/build/src\interpreter.c:166 [inlined]
eval_body at /cygdrive/c/buildbot/worker/package_win64/build/src\interpreter.c:594
jl_interpret_toplevel_thunk at /cygdrive/c/buildbot/worker/package_win64/build/src\interpreter.c:750
jl_toplevel_eval_flex at /cygdrive/c/buildbot/worker/package_win64/build/src\toplevel.c:906
jl_toplevel_eval_flex at /cygdrive/c/buildbot/worker/package_win64/build/src\toplevel.c:850
ijl_toplevel_eval at /cygdrive/c/buildbot/worker/package_win64/build/src\toplevel.c:915 [inlined]
ijl_toplevel_eval_in at /cygdrive/c/buildbot/worker/package_win64/build/src\toplevel.c:965
eval at .\boot.jl:368 [inlined]
include_string at .\loading.jl:1428
_include at .\loading.jl:1488
include at .\Base.jl:419
jfptr_include_31367.clone_1 at C:\Users\dylanxyz\AppData\Local\Programs\Julia-1.8.2\lib\julia\sys.dll (unknown line)
exec_options at .\client.jl:303
_start at .\client.jl:522
jfptr__start_43806.clone_1 at C:\Users\dylanxyz\AppData\Local\Programs\Julia-1.8.2\lib\julia\sys.dll (unknown line)
jl_apply at /cygdrive/c/buildbot/worker/package_win64/build/src\julia.h:1839 [inlined]
true_main at /cygdrive/c/buildbot/worker/package_win64/build/src\jlapi.c:575
jl_repl_entrypoint at /cygdrive/c/buildbot/worker/package_win64/build/src\jlapi.c:719
mainCRTStartup at /cygdrive/c/buildbot/worker/package_win64/build/cli\loader_exe.c:59
BaseThreadInitThunk at C:\Windows\System32\KERNEL32.DLL (unknown line)
RtlUserThreadStart at C:\Windows\SYSTEM32\ntdll.dll (unknown line)
Allocations: 6436809 (Pool: 6434730; Big: 2079); GC: 7

The problem seems to be located at .julia\packages\GLFW\BWxfF\src\callback.jl:43.

But if i use install_callbacks=false i get another error:

Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x0 -- unknown function (ip: 0000000000000000)
in expression starting at C:\Users\dylanxyz\dev\TelaUI\examples\demo.jl:15
unknown function (ip: 0000000000000000)
Allocations: 7289711 (Pool: 7287341; Big: 2370); GC: 8

I'm not sure why this happens, but i think it would be solved if we use GLFW.jl instead of using the raw glfw library,

@habemus-papadum
Copy link

I confirm this segfault as well. What is the recommended way of being notified if the screen size changes in with CImGui.jl?

It looks like originally this backend used GLFW.jl and then switched to LibGLFW.jl -- is there a reason why this was done?

@dylanxyz
Copy link
Author

dylanxyz commented Nov 2, 2023

My solution was to just set all of the GLFW callbacks using LibGLFW instead of GLFW.jl, which does some additional things using Refs to store the julia functions and etc (i'm not sure if this was changed).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants