Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Crash when exiting. Bug in example code?  (Read 1872 times)

0 Members and 1 Guest are viewing this topic.

billybob

  • Newbie
  • *
  • Posts: 2
    • View Profile
Crash when exiting. Bug in example code?
« on: November 11, 2011, 02:05:26 pm »
Like many new users I based my first SFML code on the example in the docs, which has an update loop like so:

Code: [Select]
while(app.IsOpened())
{
    HandleEvents(); // calls app.Close() on close event.
    DoRendering();
    app.Display();
}


I found I was getting a crash inside the nvidia driver when I exited the app, which was caused by calling app.Close() (which deletes the gl context) followed by continuing to render. In my case calling glBindVertexArray() after the window was closed seemed to corrupt something in the driver.

It may be wise to alter the example in the docs so that it doesn't do any rendering after the window is closed, if only to save others the trouble of debugging this.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Crash when exiting. Bug in example code?
« Reply #1 on: November 11, 2011, 02:34:43 pm »
SFML rendering is ok after the window is closed. Only OpenGL rendering will cause problems.
Laurent Gomila - SFML developer

billybob

  • Newbie
  • *
  • Posts: 2
    • View Profile
Crash when exiting. Bug in example code?
« Reply #2 on: November 11, 2011, 02:50:15 pm »
Ah, ok. I didn't realise there was such a distinction.

 

anything