Print Page | Close Window

[16.3; VS2012] SkinM. Access violation upon exit

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Skin Framework
Forum Description: Topics Related to Codejock Skin Framework
URL: http://forum.codejock.com/forum_posts.asp?TID=22243
Printed Date: 21 November 2024 at 10:26am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: [16.3; VS2012] SkinM. Access violation upon exit
Posted By: SMaton
Subject: [16.3; VS2012] SkinM. Access violation upon exit
Date 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?



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