Hello all,
I have an app running a Routine that clocks a general update at 24 frames per second. Its UI sometimes invokes a Dialog window for getting/setting file names. If such a Dialog is left open for too long, the post window starts to fill up with “scheduler queue is full” messages. I have tried enclosing the calls to Dialog in { }.forkIfNeeded but it seems to make no difference. Does anyone know how to handle this? Must I pause the AppClock before opening any Dialog?
sternsc
You can’t pause a clock. You can pause things running on the clock (e.g. your 24 fps thread).
I wasn’t aware that Dialogs would cause AppClock to get clogged, but the first thing I would try here is to stop the 24 fps routine when opening the dialog, and restart it after the user finishes.
If that gets rid of the errors, then I guess you wouldn’t want the ui to freeze… that would probably have to be a bug report
Btw which OS? The behavior may be different depending on platform.
hjh
FWIW, in Linux I was unable to reproduce AppClock blockage using this code – opening the Dialog has no effect on other items scheduled on AppClock (running it for 2-3 minutes now). But it may still happen on other platforms.
(
w = Window("test", Rect(800, 200, 500, 400)).front;
u = UserView()
.drawFunc_(Routine {
var theta = 0;
var color = Color(0.6, 1, 0.6);
var center;
var r;
loop {
center = u.bounds.center;
r = sin(theta / 2pi) * 0.9;
Pen.color_(color)
.fillOval(
Rect.aboutPoint(
Point(
center.x * (1 + (cos(theta) * r)),
center.y * (1 + (sin(theta) * r))
),
15, 15
)
);
theta = theta + 0.1;
\ok.yield;
};
});
w.layout = VLayout(u);
r = {
loop {
u.refresh;
0.05.wait;
}
}.fork(AppClock);
w.onClose = { r.stop };
)
// while the above is running:
Dialog.openPanel({ |path| path.postcs });
hjh
Thanks a lot, @jamshark70, I will experiment a bit more with stop/starting the Routine. This is on Windows 10, and all versions of SC so far.
Right now I have a more troublesome issue on MacOS, but I will start a different thread for that.
/sternsc