[futurebasic] USR ReplaceResource question

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 2006 : Group Archive : Group : All Groups

From: Joe Lertola <joefb@...>
Date: Wed, 20 Dec 2006 20:31:46 -0500
Hi all,

I am working on a part of my program that creates a small pict  
preview image, saves it in a resource file, and then display it in  
image well. I have 3 slider controls that allow the adjustment of the  
Hue, Saturation and Lightness of the colors in the pict image. As I  
scrub back and fourth with these controls the pict preview is updated  
with the new colors.

My problem is that after scrubbing for a while the program quits.  
This happens on my computer at work which has system 10.3.9. On my  
computer with at home, with system 10.4.8, I don't seem to get the  
crash.

I am guessing that the problem is caused by saving a resource too  
many times. The crash happens after calling USR ReplaceResource about  
250 times. I have not been able to isolate where the crash happens  
with def.debugstring commands. But the crash usually seems to happen  
shortly after this line:

pictHndl& = USR ReplaceResource( pictHndl&, _"PICT", _prevIconTemp,  
"tempIcon", gExternalGradientResource)

When I comment out this line there is not crash.

Is there some kind of limit on how many times a resource can be  
written? I vaguely remember something along these lines but I can't  
remember what.

Thanks for any help,
-Joe Lertola