From c285e56737fb7a50dbdca6a5a43fe0ffe6d71bed Mon Sep 17 00:00:00 2001 From: gfgtdf Date: Mon, 8 Jun 2020 19:27:39 +0200 Subject: [PATCH] fix memleak of SDL_Surface objects https://github.com/wesnoth/wesnoth/commit/ee35f6ac9adf7285fed9219a4801602a5955869f added a `surface& operator=(SDL_Surface* surf)` function that wrongly increased the refcounter of the passed surface so that it'd be leaked later. No we go back to the old behaviour where `surface& operator=(SDL_Surface* surf)` is handled by creating a temporary surface object that is calls then `surface& operator=(surface&& s)` --- src/sdl/surface.hpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/sdl/surface.hpp b/src/sdl/surface.hpp index 7d6189b84781..113e23fd8ebf 100644 --- a/src/sdl/surface.hpp +++ b/src/sdl/surface.hpp @@ -52,12 +52,6 @@ class surface return *this; } - surface& operator=(SDL_Surface* surf) - { - assign_surface_internal(surf); - return *this; - } - surface& operator=(surface&& s) NOEXCEPT { free_surface();