On Mon Jul 04, 2016 at 09:43:34AM +0200, Landry Breuil wrote:
> On Sun, Jul 03, 2016 at 09:03:26PM +0200, Rafael Sadowski wrote:
> > Hi ports@
> > 
> > Masao Uebayashi sent me the following crash description:
> > 
> > On Tue Jun 28, 2016 at 01:57:52PM +0900, Masao Uebayashi wrote:
> > > On Mon, Jun 27, 2016 at 07:51:05PM +0900, Masao Uebayashi wrote:
> > > > Could you help fixing another crash?
> > > > 
> > > > 1) Create a grid and enable snapping
> > > > 2) Enable v"Snap cusp nodes, incl. rectangle corners"
> > > > 3) F4, and make a rectanble
> > > > 4) F1, and duplicate it (Ctrl-D)
> > > > 5) F1, then move a duplicated rectangle around
> > > 
> > > Simpler:
> > > 
> > > 1) Create a grid and enable snapping
> > > 2) Enable "Snap cusp nodes, incl. rectangle corners"
> > > 3) F2, and move around any snappable point
> > 
> > I fixed the crash and he test and confirmed that the problem he had is
> > gone.
> > 
> > The diff below includes:
> > 
> > - Makefile cleanup.
> > - fix grid with snapping options.
> 
> Please, dont mix 'real fixes' with 'stylistic changes in the Makefile'
> ...
> 
> Landry


Patch without Makefile cleanup:

Index: Makefile
===================================================================
RCS file: /cvs/ports/graphics/inkscape/Makefile,v
retrieving revision 1.50
diff -u -p -u -p -r1.50 Makefile
--- Makefile    4 Jun 2016 07:00:28 -0000       1.50
+++ Makefile    4 Jul 2016 15:45:28 -0000
@@ -7,7 +7,7 @@ COMMENT=        SVG vector drawing application
 
 DISTNAME=      inkscape-0.91
 CATEGORIES=    graphics
-REVISION=      8
+REVISION=      9
 
 MASTER_SITES = https://inkscape.org/en/gallery/item/3854/
 HOMEPAGE=      http://www.inkscape.org/
Index: patches/patch-src_2geom_line_cpp
===================================================================
RCS file: patches/patch-src_2geom_line_cpp
diff -N patches/patch-src_2geom_line_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_2geom_line_cpp    4 Jul 2016 15:45:28 -0000
@@ -0,0 +1,92 @@
+$OpenBSD$
+
+null check for boost::optional<Geom::Crossing> and return empty OptCrossing
+
+--- src/2geom/line.cpp.orig    Sun Nov 30 19:45:32 2014
++++ src/2geom/line.cpp Sat Jul  2 18:54:28 2016
+@@ -246,12 +246,16 @@ OptCrossing intersection_impl( LineSegment const& ls1,
+     if ( are_near(r2.origin(), ls1) )
+     {
+         bool eqvs = (dot(direction, r2.versor()) > 0);
+-        if ( are_near(ls1.initialPoint(), r2.origin()) && !eqvs  )
++        if ( are_near(ls1.initialPoint(), r2.origin())
++             && !eqvs
++             && crossing )
+         {
+             crossing->ta = crossing->tb = 0;
+             return crossing;
+         }
+-        else if ( are_near(ls1.finalPoint(), r2.origin()) && eqvs )
++        else if ( are_near(ls1.finalPoint(), r2.origin())
++                  && eqvs
++                  && crossing )
+         {
+             if (i == 0)
+             {
+@@ -300,7 +304,8 @@ OptCrossing intersection(Line const& l1, Line const& l
+     }
+     else
+     {
+-        return crossing;
++        OptCrossing no_crossing;
++        return no_crossing;
+     }
+ }
+ 
+@@ -328,7 +333,8 @@ OptCrossing intersection(Ray const& r1, Ray const& r2)
+     if ( are_near(r1.origin(), r2) || are_near(r2.origin(), r1) )
+     {
+         if ( are_near(r1.origin(), r2.origin())
+-             && !are_near(r1.versor(), r2.versor()) )
++             && !are_near(r1.versor(), r2.versor())
++             && crossing)
+         {
+             crossing->ta = crossing->tb = 0;
+             return crossing;
+@@ -368,19 +374,24 @@ OptCrossing intersection( LineSegment const& ls1, Line
+         }
+         else
+         {
+-            return crossing;
++            OptCrossing no_crossing;
++            return no_crossing;
+         }
+     }
+ 
+     bool eqvs = (dot(direction1, direction2) > 0);
+     if ( are_near(ls2.initialPoint(), ls1) )
+     {
+-        if ( are_near(ls1.initialPoint(), ls2.initialPoint()) && !eqvs )
++        if ( are_near(ls1.initialPoint(), ls2.initialPoint())
++             && !eqvs
++             && crossing )
+         {
+             crossing->ta = crossing->tb = 0;
+             return crossing;
+         }
+-        else if ( are_near(ls1.finalPoint(), ls2.initialPoint()) && eqvs )
++        else if ( are_near(ls1.finalPoint(), ls2.initialPoint())
++                  && eqvs
++                  && crossing )
+         {
+             crossing->ta = 1;
+             crossing->tb = 0;
+@@ -393,12 +404,16 @@ OptCrossing intersection( LineSegment const& ls1, Line
+     }
+     else if ( are_near(ls2.finalPoint(), ls1) )
+     {
+-        if ( are_near(ls1.finalPoint(), ls2.finalPoint()) && !eqvs )
++        if ( are_near(ls1.finalPoint(), ls2.finalPoint())
++             && !eqvs
++             && crossing )
+         {
+             crossing->ta = crossing->tb = 1;
+             return crossing;
+         }
+-        else if ( are_near(ls1.initialPoint(), ls2.finalPoint()) && eqvs )
++        else if ( are_near(ls1.initialPoint(), ls2.finalPoint())
++                  && eqvs
++                  && crossing )
+         {
+             crossing->ta = 0;
+             crossing->tb = 1;

Reply via email to