1

I work with a large solution in Visual C++ that uses MFC. Everything worked well before changes. When I just modified a dialog and added a new one. Program began to raise exception at close at the first line of:

    if (!wglDeleteContext(m_hRc))
    {
        throw;
    }
    m_hRc = NULL;
    return;

in file RenderDevice.cpp.

I'm using TortoiseSVN and thus I reverted all the changes and recompiled the projects in solution. But the problem remained.

Can anyone tell me what could be wrong?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
user1260953
  • 35
  • 1
  • 4

4 Answers4

1

If i were you I would install Application Verifier from Microsoft and turn on the heap/memory detection for your application then run it in the debugger.

AndersK
  • 35,813
  • 6
  • 60
  • 86
0
  1. Try deleting your user settings file.
  2. Try to debug and watch for application call stack
Tariq Mehmood
  • 259
  • 1
  • 5
  • 15
0

Place GetLastError after wglDeleteContext:

if (!wglDeleteContext(m_hRc))
{
    DWORD dwError = GetLastError();
    throw;
}
m_hRc = NULL;
return;

Place debugger at line with

DWORD dwError = GetLastError();

You will get root cause why wglDeleteContext fails and why it throws exception.

rkosegi
  • 14,165
  • 5
  • 50
  • 83
0

I was having similar issues, it is happening because you're not freeing up any space that may have been allocated by your OpenGL Textures, vertex array object, VBO, FBOs, etc, in case of OpenGL at least.


if you're not using OpenGL, then see if you're freeing up the objects you've used in your program.

2am
  • 699
  • 1
  • 7
  • 25