PA_ReturnString crashing

View: New views
3 Messages — Rating Filter:   Alert me  

PA_ReturnString crashing

by Matthias Schmidt-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I have some problem with returning a CFStringRef, which just contain a
simple string: "dd.MM.yy"
I tried different approaches:
- PA_CFStringReturnAndRelease (params, cfStrResult );

and this here:
    theuStr = PA_CreateUniWithCFString (cfStrResult);
                        uChars = PA_GetUnistring (&theuStr);
                        PA_ReturnString   (params, uChars);

PA_CFStringReturnAndRelease, which was not written by me, but by Miyako
San, uses this code to create the PA_Unichar:
char* str = (char*)malloc( size );
CFStringGetCString( cfstr, str, size, kCFStringEncodingUnicode );
PA_ReturnString( params, (PA_Unichar*) str );

and  PA_CreateUniWithCFString uses this code:
PA_Unichar* uchar = (PA_Unichar*)malloc( size );
CFStringGetCString(cfstr, (char*)uchar, size, kCFStringEncodingUnicode)

as far as I understood it, both versions should work, but it is always
crashing in PA_ReturnString at this point:
void PA_SetUnistring( PA_Unistring* ustr, PA_Unichar* str )
{
        EngineBlock eb;

        eb.fUniString1 = *ustr;  <---- BANG with EXC_Bad_Access

        eb.fHandle = (PA_Handle) str;
        Call4D( EX_SET_UNISTRING, &eb );
        *ustr = eb.fUniString1;
}


I use the same code to set a line in a Text-Array and it works as expected.

So what do I miss here?


cheers,
Matthias

------------------------------------------------------------------------
Admilon Consulting GmbH
Am Wiesengrund 9a, 90584 Allersberg, Germany
Geschäftsführer: Peter Frank, Matthias Schmidt
Amtsgericht Nürnberg: HRB 21750
VAT Reg.No: DE242271157
Tel.: +49-9174 - 6646 Fax: +49-9174 - 6647
<http://www.admilon-consulting.de>
-------------------------------------------------------------------------


**********************************************************************
4D Plugins hosted by 4D, Inc.                      http://www.4D.com/

    Did you know?  The 4D Partner Program now gives you
    access to Hotfix releases as soon as they are available!
    To learn more, go to http://www.4D.com/support/partner.html

To Unsubscribe:                      mailto:4D-Plugins-off@...
***********************************************************************


Plug-in OK under Interpreted but not Compiled

by Phil Weiss :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I have a plug-in which works perfectly fine running under Interpreted with
4D v11 but not when running under Compiled.  This is on a Mac running
10.5.6.

The plug-in was built as Universal Binary using XCode 2.5.

Any help would be appreciated.


- Phil

**********************************************************************
4D Plugins hosted by 4D, Inc.                      http://www.4D.com/

    Did you know?  The 4D Partner Program now gives you
    access to Hotfix releases as soon as they are available!
    To learn more, go to http://www.4D.com/support/partner.html

To Unsubscribe:                      mailto:4D-Plugins-off@...
***********************************************************************


Re: PA_ReturnString crashing

by Matthias Schmidt-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Am/On Sat, 9 May 2009 15:35:45 +0900 schrieb/wrote Matthias Schmidt:

>Hello,
>
>I have some problem with returning a CFStringRef, which just contain a
>simple string: "dd.MM.yy"
>I tried different approaches:
>- PA_CFStringReturnAndRelease (params, cfStrResult );

never mind, found the problem.
Confused PA_CFStringReturnAndRelease and PA_CFStringSetAndRelease ..


cheers,
Matthias

**********************************************************************
4D Plugins hosted by 4D, Inc.                      http://www.4D.com/

    Did you know?  The 4D Partner Program now gives you
    access to Hotfix releases as soon as they are available!
    To learn more, go to http://www.4D.com/support/partner.html

To Unsubscribe:                      mailto:4D-Plugins-off@...
***********************************************************************