mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 13:50:13 +00:00
GUI: Fix leak of ManagedSurface in PicButtonWidget
Opening the load dialog, to display thumbnails into PicButtonWidget objects, a call to setGfx creates a temporary ManagedSurface from a Surface but is not instantiated, so not freed. Same fix applied in GraphicsWidget which code is the same and reported as potential memory leak by clang-tidy.
This commit is contained in:
parent
59c9d26963
commit
032d030060
@ -610,7 +610,9 @@ void PicButtonWidget::setGfx(const Graphics::ManagedSurface *gfx, int statenum,
|
||||
}
|
||||
|
||||
void PicButtonWidget::setGfx(const Graphics::Surface *gfx, int statenum, bool scale) {
|
||||
setGfx(new Graphics::ManagedSurface(gfx), statenum, scale);
|
||||
const Graphics::ManagedSurface *tmpGfx = new Graphics::ManagedSurface(gfx);
|
||||
setGfx(tmpGfx, statenum, scale);
|
||||
delete tmpGfx;
|
||||
}
|
||||
|
||||
void PicButtonWidget::setGfxFromTheme(const char *name, int statenum, bool scale) {
|
||||
@ -898,7 +900,9 @@ void GraphicsWidget::setGfx(const Graphics::ManagedSurface *gfx, bool scale) {
|
||||
}
|
||||
|
||||
void GraphicsWidget::setGfx(const Graphics::Surface *gfx, bool scale) {
|
||||
setGfx(new Graphics::ManagedSurface(gfx), scale);
|
||||
const Graphics::ManagedSurface *tmpGfx = new Graphics::ManagedSurface(gfx);
|
||||
setGfx(tmpGfx, scale);
|
||||
delete tmpGfx;
|
||||
}
|
||||
|
||||
void GraphicsWidget::setGfx(int w, int h, int r, int g, int b) {
|
||||
|
Loading…
Reference in New Issue
Block a user