PA_CloseQuery method

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

PA_CloseQuery method

by Doug_N :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi,
 
I have ran into some issues while upgrading our plugin with 4D Plugin API 4Dv11 so hoping someone could help.
 

I converted sources to the new plugin API.

The 4D application crashes inside when the plugin calls the PA_CloseQuery method. And that crashes also when the plugin try to access to the current selection.

The exception is "0xC0000005: Access violation reading location 0x0000001c."

 

The following test code demonstrates the exception:

 

short   err;

PA_QueryRef ref;

 

long recFound = 0L;

 

// Prepare the query

ref = PA_OpenQuery(3);

 

PA_QueryLongint(ref, 3, 2, eQO_NoOperator, eQC_IsGreaterOrEqual, 0);

 

// Start the search

// !!!!!!!!!!![SF] In this function the exception occurs - inside the Call4D( EX_QUERY, pt ); PA_CloseQuery(ref);

 

// get the result

err = PA_GetLastError();

if(!err)

{

      recFound = PA_RecordsInSelection(2);

}

 
 
Any help or suggestion would be greatly appreicated.
 
Doug.


Faster Hotmail access now on the new MSN homepage.

Re: PA_CloseQuery method

by aparajita :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> The 4D application crashes inside when the plugin calls the  
> PA_CloseQuery method. And that crashes also when the plugin try to  
> access to the current selection.
> The exception is "0xC0000005: Access violation reading location  
> 0x0000001c."
>
> Any help or suggestion would be greatly appreicated.

I had to give up on using EX_QUERY for now, there are too many bugs. I  
am building the statement and then executing it.

If you have a reproducible example, definitely report it on the 4D bug  
site so they can fix it.

Kind regards,

    Aparajita
    www.aparajitaworld.com

    "If you dare to fail, you are bound to succeed."
    - Sri Chinmoy   |   www.srichinmoy.org

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

    Register for 4D Summit 2009 Today
    http://www.4D.com/summit

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


RE: PA_CloseQuery method

by Francois Marchal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Doug,
 
Please cut/paste this into the code of your PA_CloseQuery method and tell me how it works for you.
 
I just build a sample that use the code you give and it's working on my machine.
 
 
void PA_CloseQuery( PA_QueryRef ref )
{
    EngineBlock* pt;
    short tmpErr;
    if ( ref )
    {
        pt = (EngineBlock*) PA_LockHandle( ref );
        if ( sErrorCode == eER_NoErr )
        {
            Call4D( EX_QUERY, pt );
            tmpErr = (PA_ErrorCode) pt->fError;
            PA_UnlockHandle( ref );
            PA_DisposeHandle( ref );
            sErrorCode = tmpErr;
        }
    }
    else
        sErrorCode = eER_InvalidQueryRef;
}

Many thanks to Jean-Denis MUYS who report the problem in 4D Bulletin Board.

Regards,

 - François Marchal (4D)

PS1 : the same error was also done in the CloseOrderBy, so you can also fix it with the same fix

void PA_CloseOrderBy( PA_OrderByRef ref )
{
    EngineBlock* pt;
    short tmpErr;
    if ( ref )
    {
        pt = (EngineBlock*) PA_LockHandle( ref );
        if ( sErrorCode == eER_NoErr )
        {
            Call4D( EX_ORDER_BY, pt );
            tmpErr = pt->fError;
            PA_UnlockHandle( ref );
            PA_DisposeHandle( ref );
            sErrorCode = tmpErr;
        }
    }
    else
        sErrorCode = eER_InvalidOrderByRef;
}

PS2: You will have soon some good news from 4D Summit about the future of 4D Plugin SDK that will perfectly fit this case (a developper found a bug and another one find the same a few weeks later)
**********************************************************************
4D Plugins hosted by 4D, Inc.                      http://www.4D.com/

    Register for 4D Summit 2009 Today
    http://www.4D.com/summit

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


RE: PA_CloseQuery method

by Doug_N :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you Fancois, we'll sure give it a try and will keep you posted.

Thanks again.

RE: PA_CloseQuery method

by Doug_N :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Francois,

We have tried your suggestion but still getting the exact same exception.

Thanks

RE: PA_CloseQuery method

by Francois Marchal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Doug,

I cut/paste your sample of code in a plugin and it works for me on windows (VS8). Is it possible for you to send me (francois.marchal@...) a zipped archive that holds a sample that crashes for you (sample database + sample plugin source and project) so I can investigate further?

Thanks a lot,

 - François Marchal

-----Message d'origine-----
De : 4D-Plugins@... [mailto:4D-Plugins@...] De la part de Doug_N
Envoyé : mercredi 7 octobre 2009 15:18
À : 4D-Plugins@...
Objet : RE: PA_CloseQuery method


Hi Francois,

We have tried your suggestion but still getting the exact same exception.

Thanks
--
View this message in context: http://www.nabble.com/PA_CloseQuery-method-tp25771357p25785386.html
Sent from the 4D Plug-Ins mailing list archive at Nabble.com.

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

    Register for 4D Summit 2009 Today
    http://www.4D.com/summit

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

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

    Register for 4D Summit 2009 Today
    http://www.4D.com/summit

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


RE: PA_CloseQuery method

by Doug_N :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you Francois for looking into this.

We are preparing the package and will send it to you soon.

Thanks again.