Print Page | Close Window

Access violation when exit application

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=3824
Printed Date: 24 June 2025 at 3:23am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Access violation when exit application
Posted By: JoseAngel
Subject: Access violation when exit application
Date Posted: 21 March 2006 at 12:13pm
With v9.81 of the library, my application (only in Release, never in Debug) generates an exception when exit.

Finally I discovered the problem is in the method STDMETHODIMP CXTPAccessible::XAccessible::QueryInterface.

The method code is:

STDMETHODIMP CXTPAccessible::XAccessible::QueryInterface(
    REFIID iid, LPVOID* ppvObj)
{
    METHOD_PROLOGUE_EX_(CXTPAccessible, ExternalAccessible)
    return (HRESULT)pThis->GetAccessible()->ExternalQueryInterfac e(&iid, ppvObj);
}

Tracing pThis->GetAccessible(), the method call to the method CXTPAccessible::GetAccessible() with source code:

CCmdTarget* CXTPAccessible::GetAccessible()
{
    ASSERT(FALSE);
    return NULL;
}

So it means the first method finally is something like this:

STDMETHODIMP CXTPAccessible::XAccessible::QueryInterface(
    REFIID iid, LPVOID* ppvObj)
{
    METHOD_PROLOGUE_EX_(CXTPAccessible, ExternalAccessible)
    return     (HRESULT)NULL->ExternalQueryInterface(&iid, ppvObj);
}


Maybe pThis in CXTPAccessible::XAccessible shoud be something different than CXTPAccessible (an inherited class)

Is this a problem of the library or a problem of my software?

Thanks.




Replies:
Posted By: Oleg
Date Posted: 21 March 2006 at 12:30pm

Hello,

 

No, CXTPAccessible::GetAccessible never calls because it overriden in implementations:

for example:


CCmdTarget* CXTPCommandBar::GetAccessible()
{
 return this;
}

 

Please, try to reproduce it with some our sample.

 



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: JoseAngel
Date Posted: 22 March 2006 at 1:45am
I already found the source of error, ant it fault even with your samples.

Open your project PaneView.

Edit the file PaneView.h and add in the begining of the CPaneView class definition the line in red color....

class CPaneView : public CView
{
        CXTPControlComboBox    m_wndTest;

protected: // create from serialization only
 ....

Now compile and execute in release. When you close the application, it throw an exception.



Posted By: JoseAngel
Date Posted: 22 March 2006 at 4:46am
Finally I found my error:

In CMainFrame::OnCreateControl I was assigning in lpCreateControl->pControl a stack object, not a heap one.

When I change the stack control and become a pointer the application never crash when finish the application.

The error was really difficult to found.

Thank you.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net