[Scummvm-git-logs] scummvm master -> b06482b2c9ecbe2d1be69e1e6f383fb23e06d279

bluegr noreply at scummvm.org
Mon Sep 16 07:09:05 UTC 2024


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:
b06482b2c9 GUI: Fix leak in widgets/grid.cpp


Commit: b06482b2c9ecbe2d1be69e1e6f383fb23e06d279
    https://github.com/scummvm/scummvm/commit/b06482b2c9ecbe2d1be69e1e6f383fb23e06d279
Author: tunnelsociety (150493071+tunnelsociety at users.noreply.github.com)
Date: 2024-09-16T10:09:01+03:00

Commit Message:
GUI: Fix leak in widgets/grid.cpp

_disabledIconOverlay, a ManagedSurface regularly re-instantiated, should be
deleted rather than merely have its free() method called.

While here, remove an if() which is guaranteed true lest scummvm segfault.

Changed paths:
    gui/widgets/grid.cpp


diff --git a/gui/widgets/grid.cpp b/gui/widgets/grid.cpp
index 46ea76623c6..5da87c5b6e9 100644
--- a/gui/widgets/grid.cpp
+++ b/gui/widgets/grid.cpp
@@ -1070,8 +1070,7 @@ void GridWidget::reflowLayout() {
 		_platformIconsAlpha.clear();
 		_languageIconsAlpha.clear();
 		_extraIconsAlpha.clear();
-		if (_disabledIconOverlay)
-			_disabledIconOverlay->free();
+		delete _disabledIconOverlay;
 		reloadThumbnails();
 		loadFlagIcons();
 		loadPlatformIcons();
@@ -1080,10 +1079,7 @@ void GridWidget::reflowLayout() {
 		Graphics::ManagedSurface *gfx = new Graphics::ManagedSurface(_thumbnailWidth, _thumbnailHeight, g_system->getOverlayFormat());
 		uint32 disabledThumbnailColor = gfx->format.ARGBToColor(153, 0, 0, 0);  // 60% opacity black
 		gfx->fillRect(Common::Rect(0, 0, _thumbnailWidth, _thumbnailHeight), disabledThumbnailColor);
-		if (gfx)
-			_disabledIconOverlay = gfx;
-		else
-			_disabledIconOverlay = nullptr;
+		_disabledIconOverlay = gfx;
 	}
 
 	_trayHeight = kLineHeight * 3;




More information about the Scummvm-git-logs mailing list