[Scummvm-git-logs] scummvm master -> 8a91b6a1c70d1c501d5f0d126fe07ec4ee7df167

sev- noreply at scummvm.org
Fri Oct 25 18:06:32 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:
8a91b6a1c7 GUI: Fix a crash when exiting the grid view


Commit: 8a91b6a1c70d1c501d5f0d126fe07ec4ee7df167
    https://github.com/scummvm/scummvm/commit/8a91b6a1c70d1c501d5f0d126fe07ec4ee7df167
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2024-10-25T20:06:28+02:00

Commit Message:
GUI: Fix a crash when exiting the grid view

Changed paths:
    gui/widgets/grid.cpp


diff --git a/gui/widgets/grid.cpp b/gui/widgets/grid.cpp
index b3d20b6119e..ecbfcf380fe 100644
--- a/gui/widgets/grid.cpp
+++ b/gui/widgets/grid.cpp
@@ -50,6 +50,7 @@ void GridItemWidget::updateThumb() {
 	const Graphics::ManagedSurface *gfx = _grid->filenameToSurface(_activeEntry->thumbPath);
 	_thumbGfx.free();
 	if (gfx) {
+		// TODO: Use a reference instead of copying the surface
 		_thumbGfx.copyFrom(*gfx);
 		_thumbAlpha = _thumbGfx.detectAlpha();
 	}
@@ -714,7 +715,10 @@ void GridWidget::reloadThumbnails() {
 					surf = loadSurfaceFromFile(path);
 				} else {
 					const Graphics::ManagedSurface *scSurf = _loadedSurfaces[path];
-					_loadedSurfaces[entry->thumbPath] = scSurf;
+					// TODO: Use SharedPtr instead of duplicating the surface
+					Graphics::ManagedSurface *thSurf = new Graphics::ManagedSurface();
+					thSurf->copyFrom(*scSurf);
+					_loadedSurfaces[entry->thumbPath] = thSurf;
 				}
 			}
 
@@ -723,7 +727,10 @@ void GridWidget::reloadThumbnails() {
 				_loadedSurfaces[entry->thumbPath] = scSurf;
 
 				if (path != entry->thumbPath) {
-					_loadedSurfaces[path] = scSurf;
+					// TODO: Use SharedPtr instead of duplicating the surface
+					Graphics::ManagedSurface *thSurf = new Graphics::ManagedSurface();
+					thSurf->copyFrom(*scSurf);
+					_loadedSurfaces[path] = thSurf;
 				}
 
 				if (surf != scSurf) {




More information about the Scummvm-git-logs mailing list