← Back to team overview

unity-dev team mailing list archive

[Ayatana-dev] Patch to fix memory leak in WindowsList::removeWindow()

 

While I was investigating a unity-2d-spread crash bug I noticed that there was 
a memory leak in the WindowsList::removeWindow() method. When a WindowInfo* 
pointer was removed from the list it wasn't being deleted. Please find attached 
a patch to fix this.

-- Richard
=== modified file 'libunity-2d-private/Unity2d/windowslist.cpp'
--- libunity-2d-private/Unity2d/windowslist.cpp	2011-02-08 11:48:16 +0000
+++ libunity-2d-private/Unity2d/windowslist.cpp	2011-04-12 14:18:13 +0000
@@ -183,7 +183,7 @@
     for (int i = 0; i < m_windows.length(); i++) {
         if (m_windows.at(i)->isSameBamfWindow(window)) {
             beginRemoveRows(QModelIndex(), i, i);
-            m_windows.removeAt(i);
+            delete m_windows.takeAt(i);
             endRemoveRows();
             return;
         }


Follow ups