Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Access violation when exit application
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Access violation when exit application

 Post Reply Post Reply
Author
Message
JoseAngel View Drop Down
Groupie
Groupie


Joined: 21 March 2006
Location: Spain
Status: Offline
Points: 35
Post Options Post Options   Thanks (0) Thanks(0)   Quote JoseAngel Quote  Post ReplyReply Direct Link To This Post Topic: Access violation when exit application
    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.

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
JoseAngel View Drop Down
Groupie
Groupie


Joined: 21 March 2006
Location: Spain
Status: Offline
Points: 35
Post Options Post Options   Thanks (0) Thanks(0)   Quote JoseAngel Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
JoseAngel View Drop Down
Groupie
Groupie


Joined: 21 March 2006
Location: Spain
Status: Offline
Points: 35
Post Options Post Options   Thanks (0) Thanks(0)   Quote JoseAngel Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.047 seconds.