realbasic-plugins
[Top] [All Lists]

Re: CFStrings on Win32

To: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot com>
Subject: Re: CFStrings on Win32
From: Dave Addey <listmail1 at dsl dot pipex dot com>
Date: Fri, 27 Jan 2006 16:39:32 +0000
Delivered-to: realbasic-plugins at lists dot realsoftware dot com
Thread-index: AcYjSE/LjqNTdI87Edqp0QAKldpEygABRlb2AAFBkY0AAwnXJwAAaj8Z
Thread-topic: CFStrings on Win32
Hi Chris,

Thanks! That hasn't fixed the problem, but it is definitely a much better
bit of code than I had before.  I've never worked with REALstrings in a
plugin before, so this is all a bit new.  So, once I do get this working, my
strings will be much safer :-)

Still got the same problem, though.  I'm going to check out the string in
more detail and see if it could be an encodings thing.

Dave.

> From: Chris Little <cslittle at mac dot com>
> Reply-To: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot 
> com>
> Date: Fri, 27 Jan 2006 11:27:39 -0500
> To: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot com>
> Conversation: CFStrings on Win32
> Subject: Re: CFStrings on Win32
> 
> on 1/27/06 10:00 AM, Dave Addey at listmail1 at dsl dot pipex dot com wrote:
> 
>> static void FileLocationSetter (REALobject instance, long param, REALstring
>> value)
>> {
>>     ClassData (RB_SongLoader, instance, RB_SongLoaderData, me);
>>     SongLoaderDataRef myParameters = (SongLoaderDataRef)me->myParametersRef;
>>     myParameters->FileLocation = value;
>> }
> 
> This looks suspicious. You're keeping a reference to the passed in string
> without locking it.  I wonder if the memory management on Windows is biting
> you.
> 
> The code should look like:
> 
> static void FileLocationSetter (REALobject instance, long param, REALstring
> value)
> {
>     ClassData (RB_SongLoader, instance, RB_SongLoaderData, me);
>     SongLoaderDataRef myParameters =(SongLoaderDataRef)me->myParametersRef;
> 
>     if ( myParameters->FileLocation )
>         REALUnlockString( myParameters->FileLocation ) ;
> 
>     REALLockString( value ) ;
>     myParameters->FileLocation = value;
> }
> 
> Of course you would have to change the destructor to have the same unlock
> code.
> 
> Chris
> 
> 
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
> 
> Search the archives of this list here:
> <http://support.realsoftware.com/listarchives/lists.html>


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>