[goffice] GocPolyline: fix FMW in distance function.



commit 552fecf84175ef2f24f5955373e897c0c78ff4c5
Author: Morten Welinder <terra gnome org>
Date:   Sun Mar 16 20:13:37 2014 -0400

    GocPolyline: fix FMW in distance function.

 ChangeLog                     |    4 ++++
 NEWS                          |    1 +
 goffice/canvas/goc-polyline.c |    3 ---
 3 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0399434..0a0fb5a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2014-03-16  Morten Welinder  <terra gnome org>
 
+       * goffice/canvas/goc-polyline.c (goc_polyline_distance): Don't
+       save and restore style->width.  Code was changed four years ago to
+       copy the style.  And restoring after the _unref is bad.
+
        * goffice/math/go-math.c (_go_math_init): Add test for buggy math
        library (probably caused by compiler bug).
 
diff --git a/NEWS b/NEWS
index f7aba04..cd66b33 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ Julian Sikorski:
 Morten:
        * Fix problem saving print settings.  [#698630]
        * Plug leak.
+       * Fix FMW problem with GocPolyline.
 
 --------------------------------------------------------------------------
 goffice 0.10.12:
diff --git a/goffice/canvas/goc-polyline.c b/goffice/canvas/goc-polyline.c
index c71df09..559748e 100644
--- a/goffice/canvas/goc-polyline.c
+++ b/goffice/canvas/goc-polyline.c
@@ -191,7 +191,6 @@ goc_polyline_distance (GocItem *item, double x, double y, GocItem **near_item)
 {
        GocPolyline *polyline = GOC_POLYLINE (item);
        GOStyle *style = go_style_dup (go_styled_object_get_style (GO_STYLED_OBJECT (item)));
-       double tmp_width = 0;
        double res = 20;
        double ppu = goc_canvas_get_pixels_per_unit (item->canvas);
        cairo_surface_t *surface;
@@ -201,7 +200,6 @@ goc_polyline_distance (GocItem *item, double x, double y, GocItem **near_item)
                return res;
 
        *near_item = item;
-       tmp_width = style->line.width;
        if (style->line.width * ppu < 5)
                style->line.width = 5. / (ppu * ppu);
        else
@@ -217,7 +215,6 @@ goc_polyline_distance (GocItem *item, double x, double y, GocItem **near_item)
        g_object_unref (style);
        cairo_destroy (cr);
        cairo_surface_destroy (surface);
-       style->line.width = tmp_width;
        return res;
 }
 


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