Hi, I'm running your Lua test code here, using the main.cpp program. I pressed 5 times the Done button, it worked ok. The dialog is closed every time. The I run again and closed the dialog in the system close button X. It closed ok too. I alternate between Done and Close, ok too. I uncomment the destroy after MainLoop, ok too. Sorry I couldn't reproduce your problem here. I tested using Lua 5.1.
Best, Scuri Em seg., 27 de jul. de 2020 às 10:58, Eves, Brian <brian.e...@nrc-cnrc.gc.ca> escreveu: > Hi Scuri, > > > > The initial funny behavior I had observed is due to a mistake on my part. > > > > I've included a new script and lua engine file that are almost the same as > the previous ones but without the filedlg part and with the IUP > state preserved. I originally did not include the destroy command after > leaving iup.MainLoop and the behavior between the close_cb callback > function and sending iup.CLOSE via the button action were very different. > The dialogs would only 'disappear' when the close_cb callback function were > called, but would remain when sending iup.CLOSE (via clicking the 'Done' > button) even though the iup.MainLoop would exit. Attempting to close the > still visible dialog via the close_cb would crash the engine. What was > surprising to me was that running the second script would 'reattach' the > original orphaned dialog such that the close_cb could be used on both > dialogs. Of course calling destroy or hide on the dialog fixes this > problem. What is the preferred way or are they essentially equivalent? > > > > Note that the behavior of filedlg is still the same when the IUP state is > preserved and is still a problem. > > > > Thanks, > > > > Brian > > > > *From:* Antonio Scuri <antonio.sc...@gmail.com> > *Sent:* July 27, 2020 9:21 AM > *To:* IUP discussion list. > *Subject:* Re: [Iup-users] Executing multiple IUP lua scripts from within > a single lua_State > > I think we should investigate those funny behaviors. > > Best, > Scuri > > > Em seg., 27 de jul. de 2020 às 09:55, Eves, Brian < > brian.e...@nrc-cnrc.gc.ca> escreveu: > >> Hi Scuri, >> >> >> >> I was originally preserving IUP but was noticing some funny behavior when >> closing dialogs. I had wondered if the fact that I was not cleaning up IUP >> between scripts was somehow causing the problems. I thought I had >> mitigated these problems with the current setup where IUP is closed but >> then I encountered this filedlg issue. >> >> >> >> I'm running this on a Windows 10 machine using mingw (via MSys2) and gcc >> to compile. >> >> >> >> Thanks, >> >> >> >> Brian >> ------------------------------ >> *From:* Antonio Scuri <antonio.sc...@gmail.com> >> *Sent:* July 24, 2020 4:44 PM >> *To:* IUP discussion list. >> *Subject:* Re: [Iup-users] Executing multiple IUP lua scripts from >> within a single lua_State >> >> I have no idea. WHen I have some time I'll run your test code to see >> where it is crashing. >> >> But why to preserve Lua, CD and IM but not IUP? >> >> Best, >> Scuri >> >> >> Em sex., 24 de jul. de 2020 às 17:03, Eves, Brian < >> brian.e...@nrc-cnrc.gc.ca> escreveu: >> >>> Hi, >>> >>> >>> >>> I use lua scripts to control hardware for experiments and use a >>> single lua_State to execute different lua IUP scripts so that state >>> information can be retained between scripts. I've encountered a problem >>> that can be replicated using the attached files. The main.cpp file simply >>> creates a lua_State and executes a single script five times in a row. The >>> lua script pops up an iup.filedlg, prints the chosen file name to stdout, >>> and then shows a simple dialog with only one button that ends the script. >>> The first execution of the scripts works fine, but on the second execution >>> the program crashes. If the iup.filedlg is moved into the button callback >>> then the script executes five times without any problems. >>> >>> >>> >>> Am I doing something wrong cleaning IUP between running the scripts? >>> >>> >>> >>> Thanks for your help, >>> >>> >>> >>> Brian >>> _______________________________________________ >>> Iup-users mailing list >>> Iup-users@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/iup-users >>> >> _______________________________________________ >> Iup-users mailing list >> Iup-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/iup-users >> > _______________________________________________ > Iup-users mailing list > Iup-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/iup-users >
_______________________________________________ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users