Hi Scuri,

I spent the afternoon digging myself through the code, learning the
internals of coroutines in the Lua interpreter and about how iuplua
handles the lua_State context; my conclusion is that iuplua seems to
pass around the wrong lua_State, using the thread `L` instead of the
main `L`, which causes a nasty mixup when resuming coroutines from
a iup callback.

I came up with a fix that makes sure the main lua_State is stored
and used in the iup callbacks, which seems to solve my problem.

As I prepared my patch to play nicely with the lastest iup version
I cloned the svn repo - only to find that exactly this change was
already part of the upstream code, commit r5923 with the log message
"Using the main thread for the IupLua callbacks"

So, the bad news is that I wasted a few hours, the good news is that I
learned a lot and got my problem fixed.

Would it be possible to release a new iup version from the latest svn
master to have this fix available in the official build?

Thanks!

Ico


Quoting Ico (2022-05-26 14:00:01)

> I'm still running into some issues when mixing iup and coroutines, the
> snippet below results in a reproducable crash on both linux and win32.
 
--
:wq
^X^Cy^K^X^C^C^C^C


_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to