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.

  require "iuplua"
  
  iup.SetGlobal("IUPLUA_THREADED", 1)
  
  local function main()
     local co = coroutine.running()
     local dlg = iup.dialog {
        iup.button {
           title = "&Button",
           -- on button press, resume the coroutine
           action = function()
              coroutine.resume(co)
           end
        }
     }
  
     -- show the dialog and yield until we get resumed
     dlg:show()
     coroutine.yield()
  end
  
  
  local co = coroutine.create(main)
  coroutine.resume(co)
  
  iup.MainLoop()


This is a minimized fragment from my actual code base: the UI mainly runs in
coroutine context; a widget is created and the coroutine yield()s, until an
action is triggered from a iup callback which tries to resume() the coroutine.

This seems not to be related to the garbage collection issues I ran in before,
which needed me to set the "IUPLUA_THREADED" global to prevent lua from GCing
coroutines;


gdb stack trace:

  Thread 1 "lua" received signal SIGSEGV, Segmentation fault.
  #0  0x0000555555a213c8 in  ()
  #1  0x0000555555561e62 in resume (L=L@entry=0x555555a41998, 
ud=ud@entry=0x7fffffffc85c) at ldo.c:777
  #2  0x0000555555560f7a in luaD_rawrunprotected
      (L=L@entry=0x555555a41998, f=f@entry=0x555555561de0 <resume>, 
ud=ud@entry=0x7fffffffc85c) at ldo.c:145
  #3  0x0000555555562118 in lua_resume (L=L@entry=0x555555a41998, 
from=from@entry=0x555555a41998, nargs=<optimized out>, 
      nargs@entry=0, nresults=nresults@entry=0x7fffffffc89c) at ldo.c:825
  #4  0x000055555557b891 in auxresume (L=L@entry=0x555555a41998, 
co=co@entry=0x555555a41998, narg=0) at lcorolib.c:39
  #5  0x000055555557bbff in luaB_coresume (L=0x555555a41998) at lcorolib.c:59
  #6  0x0000555555561c01 in precallC (f=0x55555557bbd0 <luaB_coresume>, 
nresults=0, func=0x555555a63b90, L=0x555555a41998) at ldo.c:507
  #7  luaD_precall (L=L@entry=0x555555a41998, func=<optimized out>, 
func@entry=0x555555a63b90, nresults=0) at ldo.c:573
  #8  0x000055555556ffec in luaV_execute (L=L@entry=0x555555a41998, 
ci=<optimized out>) at lvm.c:1636
  #9  0x0000555555561fd0 in ccall (inc=65537, nResults=<optimized out>, 
func=<optimized out>, L=0x555555a41998) at ldo.c:610
  #10 luaD_callnoyield (L=0x555555a41998, func=<optimized out>, 
nResults=<optimized out>) at ldo.c:628
  #11 0x0000555555560f7a in luaD_rawrunprotected
      (L=L@entry=0x555555a41998, f=f@entry=0x55555555c930 <f_call>, 
ud=ud@entry=0x7fffffffcb60) at ldo.c:145
  #12 0x0000555555562360 in luaD_pcall
      (L=L@entry=0x555555a41998, func=func@entry=0x55555555c930 <f_call>, 
u=u@entry=0x7fffffffcb60, old_top=96, ef=<optimized out>)
      at ldo.c:931
  #13 0x000055555555ec6c in lua_pcallk
      (L=0x555555a41998, nargs=<optimized out>, nresults=1, errfunc=<optimized 
out>, ctx=<optimized out>, k=<optimized out>)
      at lapi.c:1067
  #14 0x00007ffff7c4ffba in docall () at ./iuplua.so
  #15 0x00007ffff7c50298 in iuplua_call () at ./iuplua.so
  #16 0x00007ffff7b7f6b1 in gtkButtonClicked () at 
/home/ico/sandbox/rodney/vestel/linux/iup/libiup.so
  #17 0x00007ffff6f7c949 in  () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
  #18 0x00007ffff6f95499 in g_signal_emit_valist () at 
/lib/x86_64-linux-gnu/libgobject-2.0.so.0
  #19 0x00007ffff6f956bf in g_signal_emit () at 
/lib/x86_64-linux-gnu/libgobject-2.0.so.0
  #20 0x00007ffff73d0351 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
  #21 0x00007ffff76841a4 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
  #22 0x00007ffff6f7c877 in  () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0


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

Reply via email to