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

sev- noreply at scummvm.org
Sun Nov 14 13:40:59 UTC 2021


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
502a385ec7 GUI: Guard against double inserting of same objects to the trash queue
c5d6bd0e58 GUI: Streamlined widget deletion


Commit: 502a385ec79a3bc853b1f59f21cb7b13bfdbc7e8
    https://github.com/scummvm/scummvm/commit/502a385ec79a3bc853b1f59f21cb7b13bfdbc7e8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-11-14T14:39:56+01:00

Commit Message:
GUI: Guard against double inserting of same objects to the trash queue

Changed paths:
    gui/gui-manager.cpp


diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index f36c266438..1e1ed1529e 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -411,7 +411,7 @@ Dialog *GuiManager::getTopDialog() const {
 	return _dialogStack.top();
 }
 
-void GuiManager::addToTrash(GuiObject* object, Dialog* parent) {
+void GuiManager::addToTrash(GuiObject* object, Dialog *parent) {
 	debug(7, "Adding Gui Object %p to trash", (void *)object);
 	GuiObjectTrashItem t;
 	t.object = object;
@@ -425,6 +425,14 @@ void GuiManager::addToTrash(GuiObject* object, Dialog* parent) {
 			}
 		}
 	}
+
+	for (auto it = _guiObjectTrash.begin(); it != _guiObjectTrash.end(); ++it) {
+		if (it->object == object) {
+			debug(6, "The object %p was already scheduled for deletion, skipping", (void *)(*it).object);
+			return;
+		}
+	}
+
 	_guiObjectTrash.push_back(t);
 }
 


Commit: c5d6bd0e5826f6b082b1716923b42c05e5ab7d9e
    https://github.com/scummvm/scummvm/commit/c5d6bd0e5826f6b082b1716923b42c05e5ab7d9e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-11-14T14:39:56+01:00

Commit Message:
GUI: Streamlined widget deletion

Changed paths:
    gui/launcher.cpp


diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index e92308b226..a0a2539a89 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -737,8 +737,7 @@ void LauncherDialog::reflowLayout() {
 
 		if (_logo) {
 			removeWidget(_logo);
-			_logo->setNext(nullptr);
-			delete _logo;
+			g_gui.addToTrash(_logo, this);
 			_logo = nullptr;
 		}
 	}
@@ -750,8 +749,7 @@ void LauncherDialog::reflowLayout() {
 
 		if (_searchDesc) {
 			removeWidget(_searchDesc);
-			_searchDesc->setNext(nullptr);
-			delete _searchDesc;
+			g_gui.addToTrash(_searchDesc, this);
 			_searchDesc = nullptr;
 		}
 
@@ -762,8 +760,7 @@ void LauncherDialog::reflowLayout() {
 
 		if (_grpChooserDesc) {
 			removeWidget(_grpChooserDesc);
-			_grpChooserDesc->setNext(nullptr);
-			delete _grpChooserDesc;
+			g_gui.addToTrash(_grpChooserDesc, this);
 			_grpChooserDesc = nullptr;
 		}
 
@@ -773,8 +770,7 @@ void LauncherDialog::reflowLayout() {
 
 		if (_searchPic) {
 			removeWidget(_searchPic);
-			_searchPic->setNext(nullptr);
-			delete _searchPic;
+			g_gui.addToTrash(_searchPic, this);
 			_searchPic = nullptr;
 		}
 
@@ -783,15 +779,13 @@ void LauncherDialog::reflowLayout() {
 
 		if (_groupPic) {
 			removeWidget(_groupPic);
-			_groupPic->setNext(nullptr);
-			delete _groupPic;
+			g_gui.addToTrash(_groupPic, this);
 			_groupPic = nullptr;
 		}
 	}
 
 	removeWidget(_searchClearButton);
-	_searchClearButton->setNext(nullptr);
-	delete _searchClearButton;
+	g_gui.addToTrash(_searchClearButton, this);
 	_searchClearButton = addClearButton(this, _title + ".SearchClearButton", kSearchClearCmd);
 #endif
 #ifndef DISABLE_LAUNCHERDISPLAY_GRID
@@ -807,14 +801,16 @@ void LauncherDialog::reflowLayout() {
 #ifndef DISABLE_LAUNCHERDISPLAY_GRID
 void LauncherDialog::addLayoutChooserButtons() {
 	if (_listButton) {
+		warning("Marking listButton for removal %p", (void *)_listButton);
 		removeWidget(_listButton);
-		delete _listButton;
+		g_gui.addToTrash(_listButton, this);
 		_listButton = nullptr;
 	}
 
 	if (_gridButton) {
+		warning("Marking gridButton for removal %p", (void *)_gridButton);
 		removeWidget(_gridButton);
-		delete _gridButton;
+		g_gui.addToTrash(_gridButton, this);
 		_gridButton = nullptr;
 	}
 




More information about the Scummvm-git-logs mailing list