Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ResolveAlias leads to crash



On 7/28/05 3:27 PM, Igor Garnov didst favor us with:

> thanks everyone and sorry for being stubborn with my belief that
> &pointer = handle. I missed the keyword stating that handle is
> something more than just a pointer to a pointer. No I seem to get the
> point (-:

The whole point to a Handle is that it gives you a reference to a block of
memory that can be relocated. Relocated means, of course, that a new block
will be allocated and the contents of the old block copied before releasing
the new block. In order to do that, the Memory Manager needs to manage the
memory allocations, which isn't possible if you just pass a pointer to a
pointer, and in fact, the memory pointed to by a pointer to a pointer
doesn't even have to be on the heap.

>> What data are you storing? The only way to get the data you can use in an
>> AliasHandle is to use one of the NewAlias APIs. Have you stored data from an
>> AliasHandle in your preferences or some such thing?
> 
> Exactly, I store the alias data in my preferences. Later I am trying to
> recover the initial file by giving the stored data to ResolveAlias
> function.

Then you use

alias = (AliasHandle) NewHandle( dataSize );
bcopy( ptrToData, *alias, dataSize );

Larry

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: ResolveAlias leads to crash (From: Igor Garnov <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.