From: gP T Gr8 on
I am in porting my application on vista, currently i am facing one
problem with CAtlMap.

I have a class which has a AtlMap as a member, and whenever i delete
my class pointer my application is crashing
below is the stacktrace
ntdll.dll!_RtlpCoalesceFreeBlocks(a)16() + 0xb0 bytes
ntdll.dll!@RtlpFreeHeap(a)16() + 0x10c bytes
ntdll.dll!_RtlFreeHeap(a)12() + 0x7d4 bytes
kernel32.dll!_HeapFree(a)12() + 0x14 bytes
msvcr80.dll!_free() + 0xcd bytes
mydllu.dll!My_My::CMyClass::~CMyClass() Line 195 + 0x14 bytes C++

MyClass::~MyClass(void)
{
DeleteCriticalSection( &m_ocsAccess );

->} Crash is showing here...



I can repro this almost 50% of the time. I removed the whole code
which uses the map, still i am getting the same problem.

Next, i removed the membervariable of map.. now no issue of crash.

I created a derived Map class from CAtlMap and overloaded the
distructor
CMyMap<DWORD, DWORD> m_oPositionMap;


template< typename K, typename V, class KTraits = CElementTraits< K
>, class VTraits = CElementTraits< V > >
class CMyMap:public CAtlMap< K, V, KTraits, VTraits >
{

public:
~CMyMap()
{
OutputDebugString(_T("Map is being killed..."));
}
};

But still it crashes few times. With message
Map is being killed...First-chance exception at 0x773edb2e in
Test.exe: 0xC0000005: Access violation reading location 0x4eaefc4d.
Unhandled exception at 0x773edb2e in Test.exe: 0xC0000005: Access
violation reading location 0x4eaefc4d.

Some times it takes infinite time to process at this crash point or it
crashes at same point.

This is happening in Release mode only. Someone pls help!!
Im not facing this problem in any other OS.

-gP