> Richard Penman wrote:
> > hello,
> >
> > I am useing clipping with FLTK 1.1.7 on Debian but occassionally it stalls
> > for a few seconds and I get these messages on the console:
> >
> > fl_push_clip: clip stack overflow!
> > fl_pop_clip: clip stack underflow!
> >
> > What is going on? I only have one clipping region on the stack.
>
> When I've seen that, I usually had a bug in my draw() code
> where either:
>
> 1) I was either recursively calling draw() too many times
> 2) The logic of my draw() function was skipping an fl_pop_clip()
> (causing the overflow).
>
> The 'stall for a few seconds' sounds like something in your program
> is going wrong, and I would try to identify that by running your app
> in a debugger, and hitting 'break' when the stall is happening,
> so you can inspect what's causing that.
>
> The clip buffer is implemented as a stack which I think is
> defined to a depth of 10 in fl_rect.cxx:
>
> #define STACK_SIZE 10
> #define STACK_MAX (STACK_SIZE - 1)
> static Fl_Region rstack[STACK_SIZE];
> [..]
> void fl_push_clip(int x, int y, int w, int h) {
> [..]
> if (rstackptr < STACK_MAX) rstack[++rstackptr] = r;
> else Fl::warning("fl_push_clip: clip stack overflow!\n");
>
> 10 is certainly a small value, but it shouldn't really
> get all that large, and you definitely don't want it
> too large, since all drawing operations have to be masked
> through it.
thankyou Greg. I put a counter in my draw function and found that after severe
damage the draw stack was quite deep. I couldn't find the cause so instead I
tried to forcibly limit the redraws:
draw() {
static int depth = 0;
if( depth > STACK_MAX ) return;
depth++;
..draw code
depth--
}
but then sometimes not all the damage was repaired. Do you have an idea how I
can deal with this? Is this sensible:
..
if( depth > STACK_MAX ) {
wait(X);
redraw();
return;
}
..
Also in a previous post
(http://www.fltk.org/newsgroups.php?s1+gfltk.general+v6+T+Qclip+stack+overflow)
it was said that "FLTK's clipping is only a wrapper for the
underlying graphics subsystem, and such clipping is not very robust"
Is it true the clipping is not very robust?
thanks
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk