SimpleDirectMediaLayer.jl icon indicating copy to clipboard operation
SimpleDirectMediaLayer.jl copied to clipboard

Calling SDL2.event() in SDL.jl segfaults on CreateRenderer

Open wdevore opened this issue 5 years ago • 4 comments

My setup is a Linux box running an Ubuntu flavor call Pop_OS!

I was attempting to run the runtests.jl file, however, it would segfault half way through. I traced the code to:

e = SDL2.event()

inside of SDL.jl. When I comment-out the those lines the CreateRenderer call succeeds and completes the test successfully. I haven't debugged it yet to see what the cause is, so this is just an FYI.

wdevore avatar Mar 25 '19 16:03 wdevore

I'm also having problems related to events. When I try to use SDL_WaitEvent, I get a segfault.

Is it possible that the SDL version we're using is not completely binary compatible with the version that is the source of the bindings? @jonathanBieler Could you perhaps add the script that is used to generate the bindings or document the steps you followed to create the bindings from the header files?

andswitch avatar Mar 06 '20 19:03 andswitch

I should still have the script on my laptop, I'll check.

That said the signature seems to be correct :

https://github.com/jonathanBieler/SimpleDirectMediaLayer.jl/blob/88dbc01ac6493d216bb40766052e111cf3d89433/src/lib/SDL.jl#L3361

https://wiki.libsdl.org/SDL_WaitEvent

jonathanBieler avatar Mar 09 '20 12:03 jonathanBieler

Thanks! Even if the signature is correct, who knows there might be an incompatibility in the event struct itself. Fields added/removed/updated.. If the size of the struct changed that might have something to do with it.

andswitch avatar Mar 09 '20 17:03 andswitch

Here's my script, I think only lines 22-32 are relevant :

https://gist.github.com/jonathanBieler/a68adf591027b32c91c10c3de88a0673

That said I think I wrapped this one by hand (I left a comment) :

https://github.com/jonathanBieler/SimpleDirectMediaLayer.jl/blob/88dbc01ac6493d216bb40766052e111cf3d89433/src/lib/SDL_h.jl#L1845

https://github.com/spurious/SDL-mirror/blob/6b6170caf69b4189c9a9d14fca96e97f09bbcc41/include/SDL_events.h#L558

I'm not 100% sure that's correct though. Maybe we need a Ref instead of a Ptr in our ccall too, but I never really understood the difference.

jonathanBieler avatar Mar 10 '20 09:03 jonathanBieler