I want to pass the "James" string to getTestString function, the first
time, the string could return "This is James" without any error.
Subsequently after the button is click, the application will just
hang/crash (grey out), it seem there some bugs in this code?

Screenshot: http://imagetwist.com/7896zupwtu97/a.jpg.html

Code:

FREObject getTestString(FREContext ctx, void* funcData, uint32_t argc,
FREObject argv[]) {
        FREObject result;

        //Temporary values to hold our actionscript code.
        uint32_t albumLength;
        const uint8_t *str;
        uint8_t *strAll;

        //Turn our actionscrpt code into native code.
        FREGetObjectAsUTF8(argv[0], &albumLength, &str);
        strcpy(strAll,"This is ");
        strcat(strAll,str);  //str is "James"

    //const char *str = "this is ";
    FRENewObjectFromUTF8(strlen(strAll)+1, (uint8_t *)strAll,
&result);     //UTF8 to object and return

    return result;
}

Reply via email to