mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
Fixed a potential memory leak
This commit is contained in:
@@ -45,6 +45,9 @@ Window::Window()
|
||||
|
||||
Window::~Window()
|
||||
{
|
||||
if (currentMode.icon)
|
||||
currentMode.icon->release();
|
||||
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
}
|
||||
|
||||
@@ -58,7 +61,6 @@ Window::_currentMode::_currentMode()
|
||||
|
||||
bool Window::setWindow(int width, int height, graphics::Graphics *graphics, WindowFlags *flags)
|
||||
{
|
||||
|
||||
if (graphics)
|
||||
graphics->unSetMode();
|
||||
|
||||
@@ -314,9 +316,6 @@ bool Window::setIcon(love::image::ImageData *imgd)
|
||||
|
||||
love::image::ImageData *Window::getIcon()
|
||||
{
|
||||
if (currentMode.icon)
|
||||
currentMode.icon->retain();
|
||||
|
||||
return currentMode.icon;
|
||||
}
|
||||
|
||||
|
||||
@@ -193,7 +193,10 @@ int w_getIcon(lua_State *L)
|
||||
{
|
||||
image::ImageData *i = instance->getIcon();
|
||||
if (i)
|
||||
{
|
||||
i->retain();
|
||||
luax_newtype(L, "ImageData", IMAGE_IMAGE_DATA_T, (void*) i);
|
||||
}
|
||||
else
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user