[polari] roomList: Fix leaking room headers



commit 4104817711a6740d0cf67fb6bd67a388aa8afa58
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun Feb 7 00:31:42 2016 +0100

    roomList: Fix leaking room headers
    
    When unsetting a row's header by passing null to set_header(), the row will
    drop the reference it holds on the existing header, but not destroy it.
    As a consequence, the reference we hold ourselves because of connected
    signal handlers will keep the object alive indefinitely - make sure the
    header is properly destroyed to fix this leak.

 src/roomList.js |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/roomList.js b/src/roomList.js
index 7121ba2..3dd7f37 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -564,12 +564,15 @@ const RoomList = new Lang.Class({
         let beforeAccount = getAccount(before);
         let account = getAccount(row);
 
+        let oldHeader = row.get_header();
+
         if (beforeAccount == account) {
-            row.set_header(null);
+            if (oldHeader)
+                oldHeader.destroy();
             return;
         }
 
-        if (row.get_header())
+        if (oldHeader)
             return;
 
         let roomListHeader = new RoomListHeader({ account: account });


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]