[Scummvm-git-logs] scummvm master -> badd2c59123465f6e136c3f98d93511e4339526e
lephilousophe
noreply at scummvm.org
Thu May 29 15:56:45 UTC 2025
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
4d1aa88019 GUI: Move delayed object deletion to new function
badd2c5912 GUI: Take out all the trash (fix memory leak)
Commit: 4d1aa88019b2150c378708c4eac35b5723fcea79
https://github.com/scummvm/scummvm/commit/4d1aa88019b2150c378708c4eac35b5723fcea79
Author: tunnelsociety (150493071+tunnelsociety at users.noreply.github.com)
Date: 2025-05-29T17:56:41+02:00
Commit Message:
GUI: Move delayed object deletion to new function
Changed paths:
gui/gui-manager.cpp
gui/gui-manager.h
diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index 35b2ce4ff11..436552d7b5b 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -607,15 +607,7 @@ void GuiManager::runLoop() {
}
// Delete GuiObject that have been added to the trash for a delayed deletion
- Common::List<GuiObjectTrashItem>::iterator it = _guiObjectTrash.begin();
- while (it != _guiObjectTrash.end()) {
- if ((*it).parent == nullptr || (*it).parent == activeDialog) {
- debug(7, "Delayed deletion of Gui Object %p", (void *)(*it).object);
- delete (*it).object;
- it = _guiObjectTrash.erase(it);
- } else
- ++it;
- }
+ emptyTrash(activeDialog);
// Handle tooltip for the widget under the mouse cursor.
// 1. Only try to show a tooltip if the mouse cursor was actually moved
@@ -999,4 +991,16 @@ Graphics::MacWindowManager *GuiManager::getWM() {
return _wm;
}
+void GuiManager::emptyTrash(Dialog *const activeDialog) {
+ Common::List<GuiObjectTrashItem>::iterator it = _guiObjectTrash.begin();
+ while (it != _guiObjectTrash.end()) {
+ if ((*it).parent == nullptr || (*it).parent == activeDialog) {
+ debug(7, "Delayed deletion of Gui Object %p", (void *)(*it).object);
+ delete (*it).object;
+ it = _guiObjectTrash.erase(it);
+ } else
+ ++it;
+ }
+}
+
} // End of namespace GUI
diff --git a/gui/gui-manager.h b/gui/gui-manager.h
index cf30f449f25..dc890e9c4a3 100644
--- a/gui/gui-manager.h
+++ b/gui/gui-manager.h
@@ -244,6 +244,8 @@ protected:
void giveFocusToDialog(Dialog *dialog);
void setLastMousePos(int16 x, int16 y);
+
+ void emptyTrash(Dialog *const activeDialog);
};
} // End of namespace GUI
Commit: badd2c59123465f6e136c3f98d93511e4339526e
https://github.com/scummvm/scummvm/commit/badd2c59123465f6e136c3f98d93511e4339526e
Author: tunnelsociety (150493071+tunnelsociety at users.noreply.github.com)
Date: 2025-05-29T17:56:41+02:00
Commit Message:
GUI: Take out all the trash (fix memory leak)
Objects could remain in the trash (unfreed) during quit
Changed paths:
gui/gui-manager.cpp
diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index 436552d7b5b..26301a9733f 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -675,8 +675,10 @@ void GuiManager::runLoop() {
// it will never be removed. Since we can have multiple run loops being
// called we cannot rely on catching EVENT_QUIT in the event loop above,
// since it would only catch it for the top run loop.
- if ((eventMan->shouldQuit() || (g_engine && eventMan->shouldReturnToLauncher())) && activeDialog == getTopDialog())
+ if ((eventMan->shouldQuit() || (g_engine && eventMan->shouldReturnToLauncher())) && activeDialog == getTopDialog()) {
getTopDialog()->close();
+ emptyTrash(activeDialog);
+ }
if (didSaveState) {
_theme->disable();
More information about the Scummvm-git-logs
mailing list