[mutter] tile-preview: Fix crash when falling back to default style



commit beb65f011dd7428295561dc05e315066f372032a
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Sep 22 00:03:17 2010 +0200

    tile-preview: Fix crash when falling back to default style
    
    gtk_rc_get_style_by_paths() returns NULL if no matching style was
    found and the default style should be used. Actually use the default
    style in this case.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=630003

 src/ui/tile-preview.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/ui/tile-preview.c b/src/ui/tile-preview.c
index a9ef07d..1e2a71e 100644
--- a/src/ui/tile-preview.c
+++ b/src/ui/tile-preview.c
@@ -111,6 +111,11 @@ on_preview_window_style_set (GtkWidget *widget,
                                      "GtkWindow.GtkIconView",
                                      GTK_TYPE_ICON_VIEW);
 
+  if (style != NULL)
+    g_object_ref (style);
+  else
+    style = gtk_style_new ();
+
   gtk_style_get (style, GTK_TYPE_ICON_VIEW,
                  "selection-box-color", &preview->preview_color,
                  "selection-box-alpha", &preview->preview_alpha,
@@ -120,6 +125,8 @@ on_preview_window_style_set (GtkWidget *widget,
       GdkColor selection = style->base[GTK_STATE_SELECTED];
       preview->preview_color = gdk_color_copy (&selection);
     }
+
+  g_object_unref (style);
 }
 
 MetaTilePreview *



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