diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-07-07 20:37:19 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-07-07 20:41:46 +0800 |
commit | 3ade9a67e9af31f89b707040ce89b6e20bfbdfd1 (patch) | |
tree | 0c241cee45609efa3a8cd038f7aa587a4e0bcb6e | |
parent | 9e270dd4ed8d7da9dbb517220c2352ce3c651635 (diff) | |
download | gsoc2013-evolution-3ade9a67e9af31f89b707040ce89b6e20bfbdfd1.tar gsoc2013-evolution-3ade9a67e9af31f89b707040ce89b6e20bfbdfd1.tar.gz gsoc2013-evolution-3ade9a67e9af31f89b707040ce89b6e20bfbdfd1.tar.bz2 gsoc2013-evolution-3ade9a67e9af31f89b707040ce89b6e20bfbdfd1.tar.lz gsoc2013-evolution-3ade9a67e9af31f89b707040ce89b6e20bfbdfd1.tar.xz gsoc2013-evolution-3ade9a67e9af31f89b707040ce89b6e20bfbdfd1.tar.zst gsoc2013-evolution-3ade9a67e9af31f89b707040ce89b6e20bfbdfd1.zip |
e_web_view_update_fonts(): Fix memory corruption.
Boxed GdkColors are allocated with the slice allocator, not malloc().
This has been causing me frequent and random Evolution crashes.
-rw-r--r-- | widgets/misc/e-web-view.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/widgets/misc/e-web-view.c b/widgets/misc/e-web-view.c index 8d5d614bce..5a65ad7155 100644 --- a/widgets/misc/e-web-view.c +++ b/widgets/misc/e-web-view.c @@ -2908,7 +2908,8 @@ e_web_view_update_fonts (EWebView *web_view) const gchar *styles[] = { "normal", "oblique", "italic" }; const gchar *smoothing = NULL; GtkStyleContext *context; - GdkColor *link, *visited; + GdkColor *link = NULL; + GdkColor *visited = NULL; ms = NULL; vw = NULL; @@ -2999,13 +3000,13 @@ e_web_view_update_fonts (EWebView *web_view) "visited-link-color", &visited, NULL); - if (!link) { - link = g_new0 (GdkColor, 1); + if (link == NULL) { + link = g_slice_new0 (GdkColor); link->blue = G_MAXINT16; } - if (!visited) { - visited = g_new0 (GdkColor, 1); + if (visited == NULL) { + visited = g_slice_new0 (GdkColor); visited->red = G_MAXINT16; } @@ -3019,11 +3020,8 @@ e_web_view_update_fonts (EWebView *web_view) e_color_to_value (link), e_color_to_value (visited)); - if (link) - gdk_color_free (link); - - if (visited) - gdk_color_free (visited); + gdk_color_free (link); + gdk_color_free (visited); base64 = g_base64_encode ((guchar *) stylesheet->str, stylesheet->len); g_string_free (stylesheet, TRUE); |