From dbf3d974063fdbc94ab5a38e179300490da3d93f Mon Sep 17 00:00:00 2001 From: Clement Lefebvre Date: Fri, 23 Dec 2011 00:33:33 +0000 Subject: [PATCH] Fixed memory leak and slow showDesktop --- js/ui/showDesktopButton.js | 4 ++-- js/ui/windowlist.js | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/js/ui/showDesktopButton.js b/js/ui/showDesktopButton.js index 938a912ef5..007f1b254f 100644 --- a/js/ui/showDesktopButton.js +++ b/js/ui/showDesktopButton.js @@ -41,8 +41,8 @@ ShowDesktopButton.prototype = { windows[i].unminimize(); } } - } - this._alreadyMinimizedWindows.length = []; //Apparently this is better than this._alreadyMinimizedWindows = []; + } + this._alreadyMinimizedWindows.length = []; //Apparently this is better than this._alreadyMinimizedWindows = []; } else { for ( let i = 0; i < windows.length; ++i ) { diff --git a/js/ui/windowlist.js b/js/ui/windowlist.js index 6cabf5e229..5554941ee9 100644 --- a/js/ui/windowlist.js +++ b/js/ui/windowlist.js @@ -609,7 +609,17 @@ WindowList.prototype = { }, _onMap: function(cinnamonwm, actor) { - this._refreshItems(); + /* Note by Clem: The call to this._refreshItems() below doesn't look necessary. + * When a window is mapped in a quick succession of times (for instance if + * the user repeatedly minimize/unminimize the window by clicking on the window list, + * or more often when the showDesktop button maps a lot of minimized windows in a quick succession.. + * when this happens, many calls to refreshItems are made and this creates a memory leak. + * It also slows down all the mapping and so it takes time for all windows to get unminimized after showDesktop is clicked. + * + * For now this was removed. If it needs to be put back, this isn't the place. + * If showDesktop needs it, then it should only call it once, not once per window. + */ + //this._refreshItems(); this._onWindowStateChange('map', actor); },