CFormView Assertion problem

Hello,
I am rendering an OpenGL application within MFC CFormView dialog, starting with an example found on this forum. It runs well while the program is running but when i close the dialog box (hence the program) an assertion error appears:

Debug Assertion Failed
Program:…wMerge\medical imaging…\Debug\MfcGL.exe
File:dbgheap.c
Line:1011
Expression: _CrIsValidHeapPointer(pUserData)

Please any clue on how i can sort this out? I have thought the experts on the advanced forum could have an answer

Regards

Debug Assertion Failed
Program:…wMerge\medical imaging…\Debug\MfcGL.exe
File:dbgheap.c
Line:1011
Expression: _CrIsValidHeapPointer(pUserData)

Please any clue on how i can sort this out?

Given the shutdown context, it looks as if your destructor is 'delete’ing or 'free’ing pUserData, and pUserData either a) is null, b) has never been initialized and points to somewhere random or, most likely, c) has already been 'delete’d.

Disclaimer: this is an MFC error rather than an OpenGL one, and I haven’t looked at MFC for about 8 years. You’d probably have more luck on an MFC forum.

HTH,
Mike