[Scummvm-git-logs] scummvm master -> 032d03006062869a7c0b7a118e4e412d5794fd51
sev-
sev at scummvm.org
Wed May 12 08:40:59 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
032d030060 GUI: Fix leak of ManagedSurface in PicButtonWidget
Commit: 032d03006062869a7c0b7a118e4e412d5794fd51
https://github.com/scummvm/scummvm/commit/032d03006062869a7c0b7a118e4e412d5794fd51
Author: Mathias Parnaudeau (mparnaudeau at optimum-software.fr)
Date: 2021-05-12T10:40:56+02:00
Commit Message:
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.
Changed paths:
gui/widget.cpp
diff --git a/gui/widget.cpp b/gui/widget.cpp
index 63a22fe12b..977288ddbe 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -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) {
More information about the Scummvm-git-logs
mailing list