Hello
In writing a script-based dialog recently (see link below), I noticed a couple of issues. I will mention them in separate posts to keep these matters distinct. I apologize in advance if the behaviors I describe are not in fact bugs but simply part of the PixInsight design that the script-writer must work within.
https://pixinsight.com/forum/index.php?topic=12643.0As normal, when pressing a dialog pushbutton, a function may be called. In my case, the function creates images and performs some PixelMath. However, if the user pressed the same pushbutton too quickly, i.e. before the function completed running from the previous call, the function terminated immediately and started again (or at least appeared to do so in the Process Control window). In my case, this left the function and all sorts of data structures in undefined states, leading to memory errors and eventually to the collapse of PixInsight (requiring a reload of PixInsight).
My preference when writing a script is for me not to cause PixInsight to explode. So I have used a variable to act as a type of semaphore to prevent the function from executing unless the previous call has completed its run. No more problem, at least for now, but is this the correct solution?
So, is this a problem that needs fixing, have I made an error, or is this something the script-writer must work within in a multithreaded environment?
Regards
Dean