[rkward] rkward: Fix memory leak

Thomas Friedrichsmeier null at kde.org
Fri Oct 12 12:23:29 BST 2018


Git commit 8f1d410771b911e4a0c544c09be26898c3645c74 by Thomas Friedrichsmeier.
Committed on 12/10/2018 at 11:21.
Pushed by tfry into branch 'master'.

Fix memory leak

M  +4    -1    rkward/plugin/rkcomponentmap.cpp
M  +2    -0    rkward/rkward.cpp

https://commits.kde.org/rkward/8f1d410771b911e4a0c544c09be26898c3645c74

diff --git a/rkward/plugin/rkcomponentmap.cpp b/rkward/plugin/rkcomponentmap.cpp
index d3f70dd1..8ef774b3 100644
--- a/rkward/plugin/rkcomponentmap.cpp
+++ b/rkward/plugin/rkcomponentmap.cpp
@@ -68,6 +68,8 @@ RKComponentGUIXML::RKComponentGUIXML (const QString &context_id) {
 
 RKComponentGUIXML::~RKComponentGUIXML () {
 	RK_TRACE (PLUGIN);
+
+	toplevel_menu.clear ();
 }
 
 void RKComponentGUIXML::clearGUIDescription () {
@@ -159,7 +161,8 @@ void RKComponentGUIXML::finalize () {
 
 RKComponentGUIXML::Group::~Group () {
 	for (int i = 0; i < entries.size (); ++i) {
-		delete (entries[i]);
+		if (entries[i]->is_menu) delete (static_cast<RKComponentGUIXML::Menu*> (entries[i]));   // NOTE: No virtual d'tor in base-class Entry
+		else delete (entries[i]);
 	}
 }
 
diff --git a/rkward/rkward.cpp b/rkward/rkward.cpp
index e76b3937..54b5da58 100644
--- a/rkward/rkward.cpp
+++ b/rkward/rkward.cpp
@@ -177,6 +177,8 @@ RKWardMainWindow::~RKWardMainWindow() {
 	delete RKGlobals::tracker ();
 	delete RKGlobals::rInterface ();
 	delete RControlWindow::getControl ();
+	factory ()->removeClient (RKComponentMap::getMap ());
+	delete RKComponentMap::getMap ();
 }
 
 void RKWardMainWindow::closeEvent (QCloseEvent *e) {



More information about the rkward-tracker mailing list