Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Skin Framework
  New Posts New Posts RSS Feed - [16.3; VS2012] SkinM. Access violation upon exit
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[16.3; VS2012] SkinM. Access violation upon exit

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


Joined: 04 May 2009
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote SMaton Quote  Post ReplyReply Direct Link To This Post Topic: [16.3; VS2012] SkinM. Access violation upon exit
    Posted: 20 March 2014 at 10:17am
I have a problem upon exiting my application (in debug mode). It's related to the SkinManager which seems to get accessed after the SkinManager instance has been deleted.

On exiting the application, this error is launched:

Unhandled exception at 0x0987EAA6 (ToolkitPro1630vc110D.dll) in XXX.exe: 0xC0000005: Access violation reading location 0xFEEEFF36.

Hitting break leads to the function GetMetrics() of CXTPSkinManagerSchema. One step higher, I'm in CXTPSkinManager::GetMetrics() and even one step higher I'm in CXTPSkinManagerApiHook::OnHookDeleteObject().

Now, this function is called upon exiting the application (callstack via CCmdTarget::OnFinalRelease()). It shows that XTPSkinManager() returns a "valid" pointer, which in fact is a singleton instance.

Further debugging and placing a breakpoint in the destructor of the CXTPSkinManager, it shows that it's actually destructed BEFORE the CXTPSkinManagerApiHook::OnHookDeleteObject() has been called.

The destructor looks like this:
static class CXTPSkinManager::CDestructor
{
public:
~CDestructor()
{
if (s_pInstance != NULL)
delete s_pInstance;
}

} __xtpSkinManagerDestructor;

It's clear that either the destruction should be called much later OR that the s_pInstance should be set to NULL.

I've tried latter solution but this leads to memory leaks, since a new SkinManager instance is created via XTPSkinManager()->GetMetrics() in CXTPSkinManagerApiHook::OnHookDeleteObject() which is then not deleted anymore.

Did you solve this bug?
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.109 seconds.