From: Ben Pfaff Date: Sat, 7 Jan 2012 21:14:02 +0000 (-0800) Subject: cairo: Only apply options to table items, to avoid crash. X-Git-Tag: v0.7.9~42 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=98db17130ea7872c01015bebe5f135e6b30ad1ad;p=pspp-builds.git cairo: Only apply options to table items, to avoid crash. Most of the members of struct xr_rendering, including the 'xr' member, are used only for table items. In chart items, these members are zeroed. But xr_rendering_apply_options() attempted to use the 'xr' member even for chart items, which caused a crash. This reverts and replaces the provisional fix already applied by John Darrington in commit ee7b576822f (Avoid crash rendering charts in the gui interface.), which also fixed the crash but added extra unnecessary work. Reported-by: Nick Macdonald --- diff --git a/src/output/cairo.c b/src/output/cairo.c index 8156016c..cfa96693 100644 --- a/src/output/cairo.c +++ b/src/output/cairo.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc. + Copyright (C) 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -982,7 +982,8 @@ xr_rendering_create_text (struct xr_driver *xr, const char *text, cairo_t *cr) void xr_rendering_apply_options (struct xr_rendering *xr, struct string_map *o) { - apply_options (xr->xr, o); + if (is_table_item (xr->item)) + apply_options (xr->xr, o); } struct xr_rendering * @@ -1015,8 +1016,6 @@ xr_rendering_create (struct xr_driver *xr, const struct output_item *item, { r = xzalloc (sizeof *r); r->item = output_item_ref (item); - r->xr = xr; - xr_set_cairo (xr, cr); } return r;