apicici / cimgui-love

LÖVE module for Dear ImGui obtained by wrapping cimgui with LuaJIT FFI.
MIT License
76 stars 6 forks source link

Copy to clipboard causes panic #1

Closed majorcob closed 3 years ago

majorcob commented 3 years ago

Having a fantastic time with this lib, it was very easy to set up and start using with my existing project. :)

I noticed that on the imgui demo window, some of the buttons that are (seemingly) supposed to copy things to the clipboard cause a crash.

PANIC: unprotected error in call to Lua API (bad callback)

To reproduce: show the demo window, Examples > Console, click Copy button. I'm using the Windows x86 prebuilt from 1.83-1 release.

apicici commented 3 years ago

Good catch! I looked into it and this was caused by jit compilation of the wrappers, when the wrapped C function used the clipboard callbacks (which are Lua functions).

I modified the generating script to disable jit compilation of all the wrappers (and only of the wrappers). These functions don't do much, and from my tests this change does not seem to affect performance.