[futurebasic] Re: [FB] CFDictionary with embedded a CFArray with a key @"results"

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : August 2011 : Group Archive : Group : All Groups

From: Thomas Peters <thomasg_peters@...>
Date: Sat, 6 Aug 2011 18:44:31 -0400
Yes...

long if resultsArrayNameRef
fn CFRelease( resultsArrayNameRef )'release the string reference
end if

long if selectcolsArrayNameRef
fn CFRelease( selectcolsArrayNameRef )'release the string reference
end if




On 8/6/11 6:18 PM, "Steve" <mactech@...> wrote:

>Are you releasing all the CFStringRefs that you create?
>
>On Aug 6, 2011, at 5:06 PM, Thomas Peters wrote:
>
>> I have a CFDictionary and am embedding a CFArray with a CFString key
>> @"results".  I am passing that dictionary to a function that contains a
>> BeginCFunction ... EndC block of code.  In the C code, I am grabbing the
>> array and putting items into it, then replacing the array in the
>> CFDictionary.  Everything is working as expected.
>> 
>> rows = (CFMutableArrayRef) CFDictionaryGetValue(query,
>> resultsArrayNameRef);
>> 
>> 
>> When I add another CFArray to my dictionary with a different CFString
>>key
>> @"selectcols", my code compiles, but the application quits unexpectedly.
>> I can not tell what is causing this to fail;  Is there a way to debug
>>this?
>> 
>> <snippet>
>> 
>> dim resultsArrayNameRef as CFStringRef : resultsArrayNameRef =
>>@"results"
>> dim selectcolsArrayNameRef as CFStringRef : selectcolsArrayNameRef =
>> @"selectcols"
>> dim queryDictionaryRef as CFMutableDictionaryRef : queryDictionaryRef =
>>0
>> dim resultsArrayRef as CFMutableArrayRef : resultsArrayRef = 0
>> dim selectcolsArrayRef as CFMutableArrayRef : selectcolsArrayNameRef = 0
>> 
>> queryDictionaryRef = fn CFDictionaryCreateMutable( _kCFAllocatorDefault,
>> 0, @kCFCopyStringDictionaryKeyCallBacks,
>>@kCFTypeDictionaryValueCallBacks )
>> 
>> /*  Setup the Dictionary with an empty results array */
>> resultsArrayRef = fn CFArrayCreateMutable( _kCFAllocatorDefault, 0,
>> @kCFTypeArrayCallBacks )
>> fn CFDictionaryAddValue(queryDictionaryRef, resultsArrayNameRef,
>> resultsArrayRef)
>> selectcolsArrayRef = fn CFArrayCreateMutable( _kCFAllocatorDefault, 0,
>> @kCFTypeArrayCallBacks )
>> 
>> /* call the function */
>> fn Unpack( queryDictionaryRef )
>> 
>> </snippet>
>> 
>> 
>> Thomas
>> 
>> 
>> 
>> 
>> 
>> --
>> To unsubscribe, send ANY message to:
>>futurebasic-unsubscribe@...
>> To access the list archives, go to:
>>http://freegroups.net/groups/futurebasic/
>> 
>
>
>--
>To unsubscribe, send ANY message to: futurebasic-unsubscribe@...
>To access the list archives, go to:
>http://freegroups.net/groups/futurebasic/
>
>