garrynewman / GWEN

Abandoned: GWEN - GUI Without Extravagant Nonsense.
MIT License
428 stars 102 forks source link

OpenGLSample crash fix #29

Closed DeeKayHT closed 11 years ago

DeeKayHT commented 11 years ago

Bug

When closing the window in Windows while using Visual Studio, the sample program will crash trying to free memory that was already freed.

Cause

Order of operations was causing the crash. The OpenGL renderer was being deleted first, then the TexturedBase skin at the end of main(), since it was a local variable. The crash would then occur because the skin which depended on the freed renderer.

Fix

skin was changed to a pointer, allowing it to be deleted before the OpenGL renderer.

Misc Changes

Added a newline to the end of OpenGLSample.cpp to avoid GNU compiler warnings.