[education/rkward] rkward/settings: Fix minor memleak

Thomas Friedrichsmeier null at kde.org
Sun Jul 31 11:25:55 BST 2022


Git commit 0119436b1e8f8d445c46edce10a823661fdba3fb by Thomas Friedrichsmeier.
Committed on 31/07/2022 at 10:25.
Pushed by tfry into branch 'master'.

Fix minor memleak

M  +1    -8    rkward/settings/rkrecenturls.cpp
M  +0    -1    rkward/settings/rkrecenturls.h

https://invent.kde.org/education/rkward/commit/0119436b1e8f8d445c46edce10a823661fdba3fb

diff --git a/rkward/settings/rkrecenturls.cpp b/rkward/settings/rkrecenturls.cpp
index 08985865..e3f6fc41 100644
--- a/rkward/settings/rkrecenturls.cpp
+++ b/rkward/settings/rkrecenturls.cpp
@@ -115,7 +115,7 @@ KRecentFilesAction * RKRecentUrls::action(const QString& id) {
 	RK_TRACE(SETTINGS);
 	if (!actions.contains(id)) {
 		auto cg = config();
-		auto act = new KRecentFilesAction(nullptr);
+		auto act = new KRecentFilesAction(RKWardMainWindow::getMain());
 		if (!id.isEmpty()) act->loadEntries(cg.group(id));
 		act->setMaxItems(RKSettingsModuleGeneral::maxNumRecentFiles());  // TODO: Move setting somewhere else
 		QObject::connect(act, &QObject::destroyed, [id]() { RKRecentUrls::actions.remove(id); });
@@ -125,10 +125,3 @@ KRecentFilesAction * RKRecentUrls::action(const QString& id) {
 	return actions[id];
 }
 
-void RKRecentUrls::cleanup() {
-	for (auto it = actions.constBegin(); it != actions.constEnd(); ++it) {
-		(*it)->deleteLater();
-	}
-	actions.clear();
-}
-
diff --git a/rkward/settings/rkrecenturls.h b/rkward/settings/rkrecenturls.h
index e0c36d22..e997d397 100644
--- a/rkward/settings/rkrecenturls.h
+++ b/rkward/settings/rkrecenturls.h
@@ -27,7 +27,6 @@ public:
 	static QList<QUrl> allRecentUrls(const QString &id);
 	static KRecentFilesAction* claimAction(const QString &id);
 	static void saveConfig();
-	static void cleanup();
 	static QString scriptsId();
 	static QString workspaceId();
 	static QString outputId();


More information about the rkward-tracker mailing list