title: Unhandled exception in CoreMessaging.dll during program shutdown
body: <p>I have a simple program that just displays a window, waits for a key press, and then exits. During shutdown, the app crashes, complaining about CoreMessaging.dll. Here is the sample code that has the issue:</p>
  
  <pre><code>sf::RenderWindow window;
  
  void waitForKeyPress() {
    Event event;
    bool done = false;
    while (!done) {
      while (window.pollEvent(event)) {
        if (event.type == Event::KeyPressed) {
          done = true;
        }
      }
    }
  }
  
  int main() {
    // If I don't create the window, there's no crash.
    window.create(VideoMode::getDesktopMode(), "test", Style::Default); 
    waitForKeyPress();
    return 0; // Crashes upon returning.
  }
  </code></pre>
  
  <p>This is the crash I get:</p>
  
  <blockquote>
    <p>Unhandled exception at 0x64260032 (CoreMessaging.dll) in game.exe: 0xC0000602:  A fail fast exception occurred. Exception handlers will not be invoked and the process will be terminated immediately.</p>
  </blockquote>
  
  <p>The call stack doesn't seem particularly helpful </p>
  
  <pre><code>&gt;   CoreMessaging.dll!64260032()    Unknown
      [Frames below may be incorrect and/or missing, no symbols loaded for CoreMessaging.dll] 
      [External Code] 
      InputHost.dll!5bb78a40()    Unknown
      [External Code] 
  </code></pre>
  
  <p>The project was built using Visual Studio Community 2015. What is CoreMessaging.dll and why is it having an issue with this simple app that just shows a window and closes?</p>