[metacity] ui: fix memory leak when changing theme



commit 850454563606c026398eed19437ae8d49f11f9ac
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sat Sep 30 01:00:11 2017 +0300

    ui: fix memory leak when changing theme
    
    g_set_object increments reference count of new_object.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=788078

 src/ui/ui.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/ui/ui.c b/src/ui/ui.c
index a72bfa4..7308285 100644
--- a/src/ui/ui.c
+++ b/src/ui/ui.c
@@ -872,8 +872,9 @@ meta_ui_reload_theme (MetaUI *ui)
       theme = load_theme (ui, META_THEME_TYPE_GTK, "Adwaita");
     }
 
-  g_set_object (&ui->theme, theme);
-  g_assert (ui->theme);
+  g_assert (theme);
+  g_clear_object (&ui->theme);
+  ui->theme = theme;
 
   meta_invalidate_default_icons ();
 }


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