[pan2: 54/68] fix crash posibly due to change in cairo.
- From: Petr Kovář <pmkovar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pan2: 54/68] fix crash posibly due to change in cairo.
- Date: Tue, 8 Feb 2011 23:02:34 +0000 (UTC)
commit 4646ee21c1e6bbfa9766b6728527ca2f38b38b6b
Author: K. Haley <haleykd users sf net>
Date: Fri Oct 22 16:22:20 2010 -0600
fix crash posibly due to change in cairo.
pan/gui/body-pane.cc | 6 +++---
pan/gui/xface.c | 7 +++----
2 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/pan/gui/body-pane.cc b/pan/gui/body-pane.cc
index 4ade406..b111861 100644
--- a/pan/gui/body-pane.cc
+++ b/pan/gui/body-pane.cc
@@ -1065,10 +1065,10 @@ BodyPane :: set_text_from_message (GMimeMessage * message)
// set the x-face...
gtk_image_clear(GTK_IMAGE(_xface));
const char * pch = message ? g_mime_object_get_header ((GMimeObject *) message, "X-Face") : 0;
- if (pch && _xface->window)
+ if (pch && gtk_widget_get_window(_xface) )
{
GdkPixmap *pixmap = NULL;
- pixmap = pan_gdk_pixmap_create_from_x_face (_xface->window, pch);
+ pixmap = pan_gdk_pixmap_create_from_x_face ( gtk_widget_get_window(_xface), pch);
gtk_image_set_from_pixmap (GTK_IMAGE(_xface), pixmap, NULL);
gtk_image_set_from_pixmap (GTK_IMAGE(_face), pixmap, NULL);
g_object_unref (pixmap);
@@ -1076,7 +1076,7 @@ BodyPane :: set_text_from_message (GMimeMessage * message)
// set the face
gtk_image_clear(GTK_IMAGE(_face));
pch = message ? g_mime_object_get_header ((GMimeObject *) message, "Face") : 0;
- if (pch && _face->window)
+ if (pch && gtk_widget_get_window(_face))
{
GMimeEncoding dec;
g_mime_encoding_init_decode(&dec, GMIME_CONTENT_ENCODING_BASE64);
diff --git a/pan/gui/xface.c b/pan/gui/xface.c
index 70583d5..e1f3343 100644
--- a/pan/gui/xface.c
+++ b/pan/gui/xface.c
@@ -1077,7 +1077,8 @@ pan_gdk_pixmap_create_from_x_face (GdkDrawable *widget, const char *text)
This loop written by Andy Piper.
modified to account for cairo stride.*/
- bits = g_newa (char, l);
+ cairo_surface_t *face = cairo_image_surface_create(CAIRO_FORMAT_A1, WIDTH, HEIGHT);
+ bits = cairo_image_surface_get_data(face);
for (i=0, p=F; i<l; )
{
int n, b;
@@ -1088,8 +1089,8 @@ pan_gdk_pixmap_create_from_x_face (GdkDrawable *widget, const char *text)
if( ++i % stride == WIDTH/8)
i = (i / stride + 1) * stride;
}
+ cairo_surface_mark_dirty(face);
- cairo_surface_t *face = cairo_image_surface_create_for_data(bits, CAIRO_FORMAT_A1, WIDTH, HEIGHT, stride);
pixmap = gdk_pixmap_new(widget, WIDTH, HEIGHT, -1);
cairo_t *ct = gdk_cairo_create(pixmap);
cairo_set_source_rgb(ct, 1.0, 1.0, 1.0);
@@ -1098,8 +1099,6 @@ pan_gdk_pixmap_create_from_x_face (GdkDrawable *widget, const char *text)
cairo_paint(ct);
cairo_surface_destroy(face);
cairo_destroy(ct);
-
- g_free(bits);
}
return pixmap;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]