[PATCH] Fix for gnome-canvas-image seg fault
- From: Erik Andersen <andersen xmission com>
- To: gnomehack <other-gnomehack lists debian org>
- Cc: Tony <tonyt ptialaska net>, gnome-list <gnome-list gnome org>
- Subject: [PATCH] Fix for gnome-canvas-image seg fault
- Date: Tue, 12 Jan 1999 22:35:26 -0700
Quoting Erik Andersen <andersen@xmission.com>:
> With your change in place:
>
> map_width = COLNO * ghack_glyph_width();
> map_height = ROWNO * ghack_glyph_height();
>
> I still get the same seg fault.
>
To follow up to my follow up... In GnomeHackMapWindow.c there are
exactly two calls to gnome_canvas_item_new(). One of them was not
supplying any "image", so the following (using the image already defined
above) "fixes" the problem.
ghack_map.map[i] = GNOME_CANVAS_IMAGE(
gnome_canvas_item_new (
group,
gnome_canvas_image_get_type (),
"x", (double) x1,
"y", (double) y1,
"width", (double) ghack_glyph_height(),
"height", (double) ghack_glyph_width(),
+ "image", im,
NULL) );
I think the real problem is with gnome-canvas-image.c in
gnome_canvas_image_update() at line 406 where it assumes image->im is
a non-NULL pointer and de-references it without checking like at other
places in gnome-canvas-image.c. This is a live bug and not one of our
doing this time. Patch to gnome-canvas-image.c enclosed.
-Erik
--
Erik B. Andersen Web: http://www.xmission.com/~andersen/
email: andersee@debian.org
--This message was written using 73% post-consumer electrons--
--- gnome-canvas-image.c.virgin Tue Jan 12 22:28:38 1999
+++ gnome-canvas-image.c Tue Jan 12 22:30:56 1999
@@ -403,12 +403,14 @@
gnome_canvas_update_bbox (item, c_bbox.x0, c_bbox.y0, c_bbox.x1, c_bbox.y1);
- image->affine[0] = (affine[0] * image->width) / image->im->rgb_width;
- image->affine[1] = (affine[1] * image->height) / image->im->rgb_height;
- image->affine[2] = (affine[2] * image->width) / image->im->rgb_width;
- image->affine[3] = (affine[3] * image->height) / image->im->rgb_height;
- image->affine[4] = i_bbox.x0 * affine[0] + i_bbox.y0 * affine[2] + affine[4];
- image->affine[5] = i_bbox.x0 * affine[1] + i_bbox.y0 * affine[3] + affine[5];
+ if (image->im) {
+ image->affine[0] = (affine[0] * image->width) / image->im->rgb_width;
+ image->affine[1] = (affine[1] * image->height) / image->im->rgb_height;
+ image->affine[2] = (affine[2] * image->width) / image->im->rgb_width;
+ image->affine[3] = (affine[3] * image->height) / image->im->rgb_height;
+ image->affine[4] = i_bbox.x0 * affine[0] + i_bbox.y0 * affine[2] + affine[4];
+ image->affine[5] = i_bbox.x0 * affine[1] + i_bbox.y0 * affine[3] + affine[5];
+ }
#endif
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]