On Saturday 30 Jul 2005 18:28, Guillaume Laurent wrote:
> Looks like a problem with how the size of the peak values array is
> computed :

If you look at lines 446 - 451 (451 is where it crashes):

446        if (position < 0) continue;
447        if (position >= values.size() - channels) break;
448
449        if (channels == 1) {
450
451            h1 = values[position++];

So we know that at line 451 (before the post-increment), position >= 0 
and position < size() - 1.

That guarantees we're looking up a valid vector element, except in one 
case -- when the vector is empty.  The old code has an explicit check 
for this, the new code doesn't.

If values is empty, "values.size() - channels" will wrap around 
silently, because values.size() is unsigned.  (How apposite, following 
that thread about unsigned versus signed ints the other day!)

> I did this because calling repaint() for every preview was causing
> too much flicker, so I ended up calling it only when the preview
> queue was emptied. However now that it seems calling update() works,
> I can get the old behavior back if you prefer.

Yes, I prefer -- AudioPreviewThread is clever enough to try to do 
smaller previews first, precisely to accommodate incremental refresh.


Chris


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Rosegarden-devel mailing list
[email protected] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Reply via email to