[futurebasic] Re: RELEASERESOURCE

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : July 1998 : Group Archive : Group : All Groups

From: David Blache <alterego@...>
Date: Sun, 19 Jul 1998 21:03:57 -0500
In a message dated 7/17/98 9:18 PM, Rick Brown wrote:

>Scenario 2: "without"
>---------------------
>1. You get a handle to the resource: h& = FN GET1RESOURCE(_"PICT", 3000)
>2. During the course of subsequent processing, the resource happens
>   to get purged.  But the Resource Manager _remembers_ the handle.
>3. This time, you do NOT call RELEASERESOURCE.  You've commented
>   it out of your code.
>4. Some time later, you call h& = FN GET1RESOURCE(_"PICT", 3000)
>   again.  The Resource Manager looks in its resource map and
>   says "ah!  I already have a handle that's associated with that
>   resource," and it returns that handle to your program.  The
>   problem is, it's a handle to a non-existent block.  The Resource
>   Manager does _not_ allocate a new block, and does _not_ load
>   the resource back into memory for you.  It just returns the
>   old handle.  If you now call some routine that assumes there's
>   an actual block of data associated with that handle, then you're
>   _lucky_ if you merely get unexpected program behavior.  More
>   likely, you'll crash.

Good thinking Rick!  That sounds exactly like what Lucy was having a 
problem with.

|==================================================================|
| David Blache               Software Developer / Technical Writer |
|==================================================================|
| Microcosm Software - Owner             mailto:alterego@... |
|                            http://www.thesanctuary.com/microcosm |
|==================================================================|
| Metrowerks - Documentation         mailto:dblache@... |
|                                        http://www.metrowerks.com |
|==================================================================|