[GRASS-dev] [GRASS GIS] #2476: vector digitizer crashing with _breakLineAtIntersection

#2476: vector digitizer crashing with _breakLineAtIntersection
-------------------------+--------------------------------------------------
Reporter: annakrat | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: vdigit | Platform: Linux
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
I was able to reproduce this crash every time.
  1. draw a line (just 2 points)
  2. draw an area so that it intersects with the line
  3. right click to confirm, crash

Crashing happens in
[http://trac.osgeo.org/grass/browser/grass/trunk/lib/vector/Vlib/level_two.c#L356
level_two.c] in wxdigit.py in _addFeature. Without the line, the area
closes without problem, so maybe _breakLineAtIntersection is where
something goes wrong.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2476&gt;
GRASS GIS <http://grass.osgeo.org>

#2476: vector digitizer crashing with _breakLineAtIntersection
-------------------------+--------------------------------------------------
Reporter: annakrat | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: vdigit | Platform: Linux
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by mmetz):

Replying to [ticket:2476 annakrat]:
> Crashing happens in
[http://trac.osgeo.org/grass/browser/grass/trunk/lib/vector/Vlib/level_two.c#L356
level_two.c] in wxdigit.py in _addFeature. Without the line, the area
closes without problem, so maybe _breakLineAtIntersection is where
something goes wrong.

The problem is in
[https://trac.osgeo.org/grass/browser/grass/trunk/gui/wxpython/vdigit/wxdigit.py#L1772
wxdigit.py] in _addFeature: the line is broken, afterwards the digitizer
tries to get the areas for this line. But this line no longer exists
because it has been broken into new lines -> crash.

You would need to get areas on each side before breaking the line, but the
vector lib might only be able to build areas after the new line was
broken. I would suggest to break the line only after trying to attach
centroids.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2476#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#2476: vector digitizer crashing with _breakLineAtIntersection
-------------------------+--------------------------------------------------
Reporter: annakrat | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: vdigit | Platform: Linux
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by mmetz):

Replying to [comment:1 mmetz]:
> Replying to [ticket:2476 annakrat]:
> > Crashing happens in
[http://trac.osgeo.org/grass/browser/grass/trunk/lib/vector/Vlib/level_two.c#L356
level_two.c] in wxdigit.py in _addFeature. Without the line, the area
closes without problem, so maybe _breakLineAtIntersection is where
something goes wrong.
>
> The problem is in
[https://trac.osgeo.org/grass/browser/grass/trunk/gui/wxpython/vdigit/wxdigit.py#L1772
wxdigit.py] in _addFeature: the line is broken, afterwards the digitizer
tries to get the areas for this line. But this line no longer exists
because it has been broken into new lines -> crash.
>
> You would need to get areas on each side before breaking the line, but
the vector lib might only be able to build areas after the new line was
broken. I would suggest to break the line only after trying to attach
centroids.

Fixed in r63077.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2476#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#2476: vector digitizer crashing with _breakLineAtIntersection
-------------------------+--------------------------------------------------
Reporter: annakrat | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: vdigit | Platform: Linux
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by annakrat):

Replying to [comment:2 mmetz]:
> Replying to [comment:1 mmetz]:
> > You would need to get areas on each side before breaking the line, but
the vector lib might only be able to build areas after the new line was
broken. I would suggest to break the line only after trying to attach
centroids.
>
> Fixed in r63077.

Thanks, it's not crashing any more. But when I draw a line over an area,
so that it breaks, I get this error:

{{{
Traceback (most recent call last):
   File "/home/anna/dev/grass/trunk1/dist.x86_64-unknown-
linux-gnu/gui/wxpython/mapwin/buffered.py", line 1248, in
MouseActions

self.OnRightUp(event)
   File "/home/anna/dev/grass/trunk1/dist.x86_64-unknown-
linux-gnu/gui/wxpython/mapwin/buffered.py", line 1485, in
OnRightUp

self._onRightUp(event)
   File "/home/anna/dev/grass/trunk1/dist.x86_64-unknown-
linux-gnu/gui/wxpython/vdigit/mapwindow.py", line 935, in
_onRightUp

(UserSettings.Get(group = 'vdigit', key = "category", subkey
= 'value'), )
IndexError
:
list index out of range
}}}

It seems to be related to the fix, list 'fids' is empty, but I couldn't
see what's wrong.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2476#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#2476: vector digitizer crashing with _breakLineAtIntersection
-------------------------+--------------------------------------------------
Reporter: annakrat | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: vdigit | Platform: Linux
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by mmetz):

Replying to [comment:3 annakrat]:
> Replying to [comment:2 mmetz]:
> > Replying to [comment:1 mmetz]:
> > > You would need to get areas on each side before breaking the line,
but the vector lib might only be able to build areas after the new line
was broken. I would suggest to break the line only after trying to attach
centroids.
> >
> > Fixed in r63077.
>
> Thanks, it's not crashing any more. But when I draw a line over an area,
so that it breaks, I get [another] error.
>
>
> It seems to be related to the fix, list 'fids' is empty, but I couldn't
see what's wrong.

I fixed it in r63178, list 'fids' is no longer empty but can contain
invalid line ids.

I can not close g.gui.vdigit because
[https://trac.osgeo.org/grass/browser/grass/trunk/gui/wxpython/core/giface.py#L193
GetProgress()] is not implemented, but the vector is properly created.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2476#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#2476: vector digitizer crashing with _breakLineAtIntersection
-------------------------+--------------------------------------------------
Reporter: annakrat | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: vdigit | Platform: Linux
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by annakrat):

Replying to [comment:4 mmetz]:
> I can not close g.gui.vdigit because
[https://trac.osgeo.org/grass/browser/grass/trunk/gui/wxpython/core/giface.py#L193
GetProgress()] is not implemented, but the vector is properly created.

This should be fixed in r63204.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2476#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>