mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Better cleanup when the graphics and window subsystems are destroyed and restarted.
This commit is contained in:
@@ -50,6 +50,8 @@ Graphics::Graphics()
|
||||
, created(false)
|
||||
, activeStencil(false)
|
||||
{
|
||||
gl = OpenGL();
|
||||
|
||||
states.reserve(10);
|
||||
states.push_back(DisplayState());
|
||||
|
||||
|
||||
@@ -48,12 +48,18 @@ Window::Window()
|
||||
|
||||
Window::~Window()
|
||||
{
|
||||
if (context)
|
||||
{
|
||||
graphics::Graphics *gfx = Module::getInstance<graphics::Graphics>(Module::M_GRAPHICS);
|
||||
if (gfx != nullptr)
|
||||
gfx->unSetMode();
|
||||
|
||||
SDL_GL_DeleteContext(context);
|
||||
}
|
||||
|
||||
if (window)
|
||||
SDL_DestroyWindow(window);
|
||||
|
||||
if (context)
|
||||
SDL_GL_DeleteContext(context);
|
||||
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user