[gnome-builder] sourceview: fix uninitialized spellcheck colors



commit 3a64755753c1b84c798c1a062e2be9f46f1f0b87
Author: Christian Hergert <chergert redhat com>
Date:   Tue Feb 28 16:35:00 2017 -0800

    sourceview: fix uninitialized spellcheck colors
    
    By reversing our application of color parsing, we can remove the potential
    for uninitialized GdkRGBA.

 libide/sourceview/ide-source-view.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/libide/sourceview/ide-source-view.c b/libide/sourceview/ide-source-view.c
index 4571b2e..8b58ae8 100644
--- a/libide/sourceview/ide-source-view.c
+++ b/libide/sourceview/ide-source-view.c
@@ -999,7 +999,7 @@ ide_source_view__buffer_notify_style_scheme_cb (IdeSourceView *self,
   g_autofree gchar *search_shadow_background = NULL;
   GdkRGBA spellchecker_bubble_fg;
   GdkRGBA spellchecker_bubble_bg;
-  gboolean colors_valid = TRUE;
+  gboolean colors_valid = FALSE;
 
   g_assert (IDE_IS_SOURCE_VIEW (self));
   g_assert (IDE_IS_BUFFER (buffer));
@@ -1059,11 +1059,11 @@ ide_source_view__buffer_notify_style_scheme_cb (IdeSourceView *self,
       g_object_get (spellchecker_match_style, "background", &background, NULL);
       g_object_get (spellchecker_match_style, "foreground", &foreground, NULL);
 
-      if (ide_str_empty0 (background) ||
-          !gdk_rgba_parse (&spellchecker_bubble_bg, background) ||
-          ide_str_empty0 (foreground) ||
-          !gdk_rgba_parse (&spellchecker_bubble_fg, foreground))
-        colors_valid = FALSE;
+      if (!ide_str_empty0 (background) &&
+          gdk_rgba_parse (&spellchecker_bubble_bg, background) &&
+          !ide_str_empty0 (foreground) &&
+          gdk_rgba_parse (&spellchecker_bubble_fg, foreground))
+        colors_valid = TRUE;
     }
 
   if (!colors_valid)


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