Hmmm, no locking needed....

void SetTriggerText(UInt16 ownerForm, UInt16 trigger, char *text)
{
        if( text == NULL )
                text = "";
        CtlSetLabel(GetObjectPtr(ownerForm, trigger), text);
}

Works... sorry for the bother


Morten Schmidt wrote:
Why does this make a 1 memory leak in PalmOS 4.12 but not in 5?

void SetTriggerText(UInt16 ownerForm, UInt16 trigger, char *text)
{
    MemHandle h;
    Char *dest;
    if( text == NULL )
        text = "";
    h = MemHandleNew( StrLen( text ) + 1 );
    dest = MemHandleLock( h );
    StrCopy(dest, text);
    CtlSetLabel(GetObjectPtr(ownerForm, trigger), dest);
    MemHandleUnlock( h );
}

...and how do I keep it from doing so?

/morten


-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to