Blob Blame History Raw
From 1975387a50888ad911e303a58933527ed6c48e3c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Fri, 14 Mar 2014 18:09:22 +0100
Subject: [PATCH] background: Force a GC run after removing a background

---
 js/ui/background.js | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/js/ui/background.js b/js/ui/background.js
index ad0cacc..a48934e 100644
--- a/js/ui/background.js
+++ b/js/ui/background.js
@@ -99,8 +99,10 @@ const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
 const GnomeDesktop = imports.gi.GnomeDesktop;
 const Lang = imports.lang;
+const Mainloop = imports.mainloop;
 const Meta = imports.gi.Meta;
 const Signals = imports.signals;
+const System = imports.system;
 
 const Main = imports.ui.main;
 const Params = imports.misc.params;
@@ -202,6 +204,14 @@ const BackgroundCache = new Lang.Class({
             if (source._useCount == 0) {
                 delete this._backgroundSources[settingsSchema];
                 source.destroy();
+
+                if (!this._gcId)
+                    this._gcId = Mainloop.idle_add(Lang.bind(this,
+                        function() {
+                            System.gc();
+                            this._gcId = 0;
+                            return false;
+                        }));
             }
         }
     }
-- 
2.3.3