Closed zbaylin closed 3 years ago
Thanks for the help with this, Zach! Much appreciated
@bryphe -- I think I implemented all the fixes I caught (including the ones you mentioned), but I'm still getting a segfault on GL_Setup
, which is called right after window creation.
@bryphe after our conversation last night I realized that was probably why I couldn't get this PR working. I changed the wrap and unwrap functions and, lo and behold, it works! Let me know if there is anything else you need me to do!
OSX looks good! Wasn't sure if you already tested on Windows / Linux - let me know if I can help validate either of those platforms
@bryphe I just tested Linux with both the example app and Oni2, and both work! @CrossR mentioned that he might be able to help test on Windows as well
The Icon Features bit (progress displayed on the Icon) example crashes for me on Windows with:
Fatal error: exception Invalid_argument("compare: abstract value")
Raised by primitive operation at file "examples/NativeIconExample.re", line 23, characters 11-15
Called from file "lib/Hooks.re", line 235, characters 11-70
Called from file "lib/Hooks.re", line 307, characters 17-48
Called from file "lib/HeterogenousList.re", line 94, characters 16-45
Called from file "lib/Brisk_reconciler_internal.re", line 975, characters 14-158
Called from file "lib/Brisk_reconciler_internal.re", line 735, characters 12-235
Called from file "lib/Brisk_reconciler_internal.re", line 1346, characters 14-401
Called from file "lib/Brisk_reconciler_internal.re", line 1090, characters 16-497
Called from file "lib/ListTR.re", line 32, characters 22-40
Called from file "lib/Brisk_reconciler_internal.re", line 1067, characters 10-1023
Called from file "lib/Brisk_reconciler_internal.re", line 915, characters 14-785
Called from file "lib/Brisk_reconciler_internal.re", line 735, characters 12-235
Called from file "lib/Brisk_reconciler_internal.re", line 1346, characters 14-401
Called from file "lib/Brisk_reconciler_internal.re", line 1090, characters 16-497
Called from file "lib/ListTR.re", line 32, characters 22-40
Called from file "lib/Brisk_reconciler_internal.re", line 1067, characters 10-1023
Called from file "lib/Brisk_reconciler_internal.re", line 915, characters 14-785
Called from file "lib/Brisk_reconciler_internal.re", line 735, characters 12-235
Called from file "lib/Brisk_reconciler_internal.re", line 1189, characters 12-180
Called from file "lib/Brisk_reconciler_internal.re", line 862, characters 12-236
Called from file "lib/Brisk_reconciler_internal.re", line 735, characters 12-235
Called from file "lib/Brisk_reconciler_internal.re", line 1545, characters 8-42
Called from file "lib/Brisk_reconciler_internal.re", line 1606, characters 6-124
Called from file "src/UI/Container.re", line 38, characters 10-64
Called from file "src/UI/Render.re", line 27, characters 17-56
Called from file "src/UI/Render.re", line 26, characters 2-99
Called from file "src/Core/Window.re", line 389, characters 2-17
Called from file "list.ml", line 110, characters 12-15
Called from file "src/Core/App.re", line 298, characters 6-123
Called from file "packages/reason-sdl2/src/sdl2.re", line 822, characters 10-20
Called from file "packages/reason-sdl2/src/sdl2.re", line 268, characters 17-59
Called from file "packages/reason-sdl2/src/sdl2.re", line 268, characters 17-59
Called from file "examples/Examples.re", line 378, characters 0-15
It doesn't crash on master for me, so I assume that its because of these changes? Unless its just because this PR is lagging behind master a bit...
On Oni2 I'm not getting any crashes (from a basic opening it up and opening a few files etc) but I am missing out on window handles (or whatever the name is). I.e. the ability to drag the window around, and the resize on the edges.
Revery example is happy with the latest changes, I'm getting a crash now for Oni2 though:
[ERROR] +1524ms Oni2.Exception : Exception (Invalid_argument "compare: abstract value"):
Raised by primitive operation at file "src/UI/HitTest.re", line 10, characters 12-52
Called from file "src/Core/App.re", line 313, characters 16-43
Called from file "src/Core/App.re", line 313, characters 16-43
Called from file "packages/reason-sdl2/src/sdl2.re", line 822, characters 10-20
Called from file "packages/reason-sdl2/src/sdl2.re", line 268, characters 17-59
Called from file "packages/reason-sdl2/src/sdl2.re", line 268, characters 17-59
Called from file "src/bin_editor/Oni2_editor.re", line 497, characters 11-26
Thanks @CrossR !
Looks like the crash is occurring when we try to compare windows:
if (sdlWindow == Window.getSdlWindow(window) && node#hasRendered()) {
Which, because they are wrapped in Abstract_val
, is expected!
We'll need to have another way to compare windows - like using the https://wiki.libsdl.org/SDL_GetWindowID API
This is looking good now! Just need another round of cross-plat testing to make sure everything is OK
@bryphe I just merged this up with master
and tested the example app and Oni out on macOS. All seemed to work well! I can also test on Linux and Windows!
I think it would be a good idea to get this merged before I start work on the native menus, since that will require passing pointers back and forth from the FFI a decent amount.
Windows works with both the Examples and Oni as of f2d6793 (the Window compare fix)
@bryphe I just merged this up with master and tested the example app and Oni out on macOS. All seemed to work well! I can also test on Linux and Windows!
Excellent! Sounds like you already verified on Windows - I'll try out on Linux.
I think it would be a good idea to get this merged before I start work on the native menus, since that will require passing pointers back and forth from the FFI a decent amount.
Right, that makes sense - I was just thinking about this change in the context of the NSObject PR :+1:
Linux looks good! Sounds like we're all set with this :+1:
This is currently breaking very early on -- I get a segfault with the Window in SDL2 and I can't seem to figure out why.
Here's a stack trace from LLDB:
If anybody has any ideas, let me know! I'll keep looking at it.