title: Exception thrown when exiting program (Ogre3d)
body: <p>I am getting a weird exception when I exit the program. This has started since today morning and I am ready to pull my hair out. As soon as I exit the program, visual studio gives an exception and stops at line 731 in the file crt0dat.c (see attached screenshot)</p>
  
  <p>I know this is very little to go on. I have tried several different things:</p>
  
  <ol>
  <li>un the program without doing anything, that is, not initializing Ogre Core at all. Does not result in a crash</li>
  <li>Run the program with everything commented out except creating Ogre root (which is related to Ogre itself and has nothing to do with my code), results in the same crash</li>
  <li>Run the following program which is as basic as it gets, still results in the crash. <strong>The crash happens after return 0, when my program has finished running</strong> </li>
  </ol>
  
  
  
  <pre><code>#include "windows.h"
  
  #include "OgreRoot.h"
  
  /// --------------------------------------------
  
  INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)
  {
  
      Ogre::Root* lRoot = new Ogre::Root();
  
      delete lRoot;
      lRoot = NULL;
  
      return 0;
  }
  
  /// --------------------------------------------
  </code></pre>
  
  <p>Since I have everything on the SVN, I ran the same project on my laptop and it worked without any problems, as well as exited without any problems. This led me to believe that somewhere along the line my visual studio got corrupted. I uninstalled Visual studio, then re-installed it, but the problem persists (When VS installs it goes all over my system. No way to contain it. Does anyone know a surefire way to completely destroy Visual Studio installation?). I am running out of ideas, short of re-installing windows. I hope someone here can be of help.</p>
  
  <p><strong>Callstack:</strong></p>
  
  <pre><code>  048b0910() 
    ntdll.dll!775d9901()  
    [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll] 
    ntdll.dll!775edc30()  
    ntdll.dll!775edb7c()  
    kernel32.dll!76c67363()  
  &gt; msvcr90d.dll!__crtExitProcess(int status=0)  + 0x1b bytes C
    msvcr90d.dll!doexit(int code=0, int quick=0, int retcaller=0)  + 0x1d1 bytes C
    msvcr90d.dll!exit(int code=0)  + 0x12 bytes C
    OgreFWGame.exe!__tmainCRTStartup()  + 0x2a2 bytes C
    OgreFWGame.exe!WinMainCRTStartup()  + 0xf bytes C
    kernel32.dll!76c63677()  
    ntdll.dll!775d9d42()  
    ntdll.dll!775d9d15()  
  </code></pre>
  
  <p><strong>Crash Screencapture:</strong><br>
  <a href="http://i50.tinypic.com/2ii7voj.jpg" rel="nofollow noreferrer">link text</a></p>