Browse Source

Keep a reference to the SDL video subsystem in the mouse module, since cursors need it. Potentially resolves issue #1388.

Alex Szpakowski 7 years ago
parent
commit
0cf106fa6a
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/modules/mouse/sdl/Mouse.cpp

+ 5 - 0
src/modules/mouse/sdl/Mouse.cpp

@@ -57,6 +57,9 @@ const char *Mouse::getName() const
 Mouse::Mouse()
 Mouse::Mouse()
 	: curCursor(nullptr)
 	: curCursor(nullptr)
 {
 {
+	// SDL may need the video subsystem in order to clean up the cursor when
+	// quitting. Subsystems are reference-counted.
+	SDL_InitSubSystem(SDL_INIT_VIDEO);
 }
 }
 
 
 Mouse::~Mouse()
 Mouse::~Mouse()
@@ -66,6 +69,8 @@ Mouse::~Mouse()
 
 
 	for (auto &c : systemCursors)
 	for (auto &c : systemCursors)
 		c.second->release();
 		c.second->release();
+
+	SDL_QuitSubSystem(SDL_INIT_VIDEO);
 }
 }
 
 
 love::mouse::Cursor *Mouse::newCursor(love::image::ImageData *data, int hotx, int hoty)
 love::mouse::Cursor *Mouse::newCursor(love::image::ImageData *data, int hotx, int hoty)