580c05
From 1975387a50888ad911e303a58933527ed6c48e3c Mon Sep 17 00:00:00 2001
4c1248
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
4c1248
Date: Fri, 14 Mar 2014 18:09:22 +0100
580c05
Subject: [PATCH] background: Force a GC run after removing a background
4c1248
4c1248
---
4c1248
 js/ui/background.js | 10 ++++++++++
4c1248
 1 file changed, 10 insertions(+)
4c1248
4c1248
diff --git a/js/ui/background.js b/js/ui/background.js
580c05
index ad0cacc..a48934e 100644
4c1248
--- a/js/ui/background.js
4c1248
+++ b/js/ui/background.js
580c05
@@ -99,8 +99,10 @@ const Gio = imports.gi.Gio;
4c1248
 const GLib = imports.gi.GLib;
4c1248
 const GnomeDesktop = imports.gi.GnomeDesktop;
4c1248
 const Lang = imports.lang;
4c1248
+const Mainloop = imports.mainloop;
4c1248
 const Meta = imports.gi.Meta;
4c1248
 const Signals = imports.signals;
4c1248
+const System = imports.system;
4c1248
 
4c1248
 const Main = imports.ui.main;
4c1248
 const Params = imports.misc.params;
580c05
@@ -202,6 +204,14 @@ const BackgroundCache = new Lang.Class({
580c05
             if (source._useCount == 0) {
580c05
                 delete this._backgroundSources[settingsSchema];
580c05
                 source.destroy();
580c05
+
580c05
+                if (!this._gcId)
580c05
+                    this._gcId = Mainloop.idle_add(Lang.bind(this,
580c05
+                        function() {
580c05
+                            System.gc();
580c05
+                            this._gcId = 0;
580c05
+                            return false;
580c05
+                        }));
4c1248
             }
4c1248
         }
580c05
     }
4c1248
-- 
580c05
2.3.3
4c1248