Thomas Haupt
|
Re: Aplication terminated when 2 script active at the same time.
|
Thomas Haupt
02/09/2016 2:35 AM
post115697
|
Re: Aplication terminated when 2 script active at the same time.
Afif,
unfortunately, the code and information you posted doesn't tell the whole story. One thing sticking out, though, is that
you seem to use two arrays of widget pointers (my_label[] and my_label2[]) and two indices into these arrays (a and b)
which keep being incremented on every timer tick. I don't know the exact sizes of the arrays, but letting the indices
increase without bounds seems like a bad idea no matter how large the arrays are - sooner or later, you'll always be
using "entries" beyond the array boundaries and will experience all kinds of effects.
Also, since PtUnrealizeWidget() doesn't actually delete the widget object, you currently keep piling up unrealized
widgets in the background. That's not what makes the application crash, but it causes a memory leak and will deteriorate
the GUI's performance over time.
Personally, I'd suggest using two arrays of six entries each. Create (and if possible, also realize) the widgets only
once at startup time. Then, at each timer tick, re-calculate every widget's position and use PtSetResource() to set the
Pt_ARG_POS resource of the widgets. That way, you can just move the existing widgets around instead of creating new ones
every time.
Regards,
Thomas
|
|
|