Bug report #12880

Reshape tool throws exception

Added by Nyall Dawson over 9 years ago. Updated over 9 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:Marco Hugentobler
Category:Digitising
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:20971

Description

The reshape tool is broken in master - trying to reshape a polygon results in an "Unknown exception" error.

13.mp4 - Screencast of exception and failed reshape (2.67 MB) Nyall Dawson, 2015-06-05 02:32 PM

00.mp4 - invalid line reshape (1.59 MB) Nyall Dawson, 2015-06-07 08:21 PM

History

#1 Updated by Marco Hugentobler over 9 years ago

  • Status changed from Open to Feedback

I've just reshaped a lot of polygons and did not get exceptions. Probably it does not happen in each case. If you can attach a small testfile, that would be great.

#2 Updated by Giovanni Manghi over 9 years ago

  • Category set to Digitising
  • Target version set to Future Release - High Priority

I'm also not able to replicate on the latest master.

#3 Updated by Nyall Dawson over 9 years ago

I've attached a screencast demonstrating this issue. What I see:

- Multipolygon layer - reshape fails to work. No error, but not reshape.
- Polygon layer - exception is thrown

The console shows messages like:

src/core/qgsgeometryvalidator.cpp: 244: (run) [1467ms] [thread:0x4afd720] validation thread started.
src/core/qgsgeometryvalidator.cpp: 325: (run) [1ms] [thread:0x4afd720] validation finished.
src/core/qgsgeometryvalidator.cpp: 244: (run) [342ms] [thread:0x4afd6d0] validation thread started.
src/core/qgsgeometryvalidator.cpp: 325: (run) [0ms] [thread:0x4afd6d0] validation finished.
src/core/qgsgeometryvalidator.cpp: 244: (run) [281ms] [thread:0x22bfee0] validation thread started.
src/core/qgsgeometryvalidator.cpp: 325: (run) [1ms] [thread:0x22bfee0] validation finished.
src/core/qgsgeometryvalidator.cpp: 244: (run) [321ms] [thread:0x227ee20] validation thread started.
src/core/qgsgeometryvalidator.cpp: 325: (run) [5ms] [thread:0x227ee20] validation finished.
src/core/qgsgeometryvalidator.cpp: 244: (run) [405ms] [thread:0x4e3f7e0] validation thread started.
src/core/qgsgeometryvalidator.cpp: 325: (run) [0ms] [thread:0x4e3f7e0] validation finished.
src/core/geometry/qgsgeos.cpp: 87: (throwGEOSException) [436ms] GEOS exception: IllegalArgumentException: Points of LinearRing do not form a closed linestring
src/core/qgsmessagelog.cpp: 45: (logMessage) [0ms] 2015-06-06T07:28:34 GEOS1 Exception: IllegalArgumentException: Points of LinearRing do not form a closed linestring
src/app/qgsundowidget.cpp: 106: (indexChanged) [3ms] curIndx : 2
src/app/qgsundowidget.cpp: 107: (indexChanged) [0ms] offset : 1
src/app/qgsundowidget.cpp: 108: (indexChanged) [0ms] curCount: 2
src/core/qgsvectorlayereditbuffer.cpp: 57: (undoIndexChanged) [0ms] undo index changed 2

#4 Updated by Nyall Dawson over 9 years ago

  • Status changed from Feedback to Open

I should add that this is using 7aae459

#5 Updated by Salvatore Larosa over 9 years ago

I can confirm here and I am getting the following stacktrace when closing w/o saving with a polygon scratch layer:

Program received signal SIGABRT, Aborted.
0x00007fffefc4f165 in raise () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0  0x00007fffefc4f165 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007fffefc523e0 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00000000004d566a in myMessageOutput (type=QtFatalMsg, msg=
    0x642bd08 "ASSERT: \\"mAddedFeatures.isEmpty()\\" in file /home/sam/pacchetti_gis/QGIS/src/core/qgsvectorlayereditbuffer.cpp, line 552")
    at /home/sam/pacchetti_gis/QGIS/src/app/main.cpp:369
#3  0x00007ffff2bcf630 in qt_message_output(QtMsgType, char const*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4  0x00007ffff2bcfa98 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#5  0x00007ffff2bcfc24 in qFatal(char const*, ...) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#6  0x00007ffff49a0450 in QgsVectorLayerEditBuffer::rollBack (this=0x16cc010)
    at /home/sam/pacchetti_gis/QGIS/src/core/qgsvectorlayereditbuffer.cpp:552
#7  0x00007ffff498960c in QgsVectorLayer::rollBack (this=0x1f37f00, deleteBuffer=true)
    at /home/sam/pacchetti_gis/QGIS/src/core/qgsvectorlayer.cpp:2303
#8  0x000000000050fde0 in QgisApp::toggleEditing (this=0x117b2f0, layer=0x1f37f00, allowCancel=true)
    at /home/sam/pacchetti_gis/QGIS/src/app/qgisapp.cpp:6750
#9  0x000000000050f82b in QgisApp::toggleEditing (this=0x117b2f0) at /home/sam/pacchetti_gis/QGIS/src/app/qgisapp.cpp:6670
#10 0x00000000008c7907 in QgisApp::qt_static_metacall (_o=0x117b2f0, _c=QMetaObject::InvokeMetaMethod, _id=25, _a=0x7fffffffc190)
    at /home/sam/pacchetti_gis/QGIS/build-master/src/app/moc_qgisapp.cxx:628
#11 0x00007ffff2cea54f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#12 0x00007ffff2078502 in QAction::triggered(bool) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#13 0x00007ffff20786f0 in QAction::activate(QAction::ActionEvent) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#14 0x00007ffff243885f in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#15 0x00007ffff2438b0c in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#16 0x00007ffff24f2a8a in QToolButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#17 0x00007ffff20cde10 in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#18 0x00007ffff207e70c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#19 0x00007ffff20833eb in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#20 0x00007ffff479bb2e in QgsApplication::notify (this=0x7fffffffd890, receiver=0x11bfb30, event=0x7fffffffcb40)
    at /home/sam/pacchetti_gis/QGIS/src/core/qgsapplication.cpp:253
#21 0x00007ffff2cd4b5e in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4

#6 Updated by Mathieu Pellerin - nIRV over 9 years ago

Guys, commit 8cdf0d6 appears to have fixed this blocker. I can't duplicate the issue using a build containing the commit.

#7 Updated by Giovanni Manghi over 9 years ago

  • Status changed from Open to Feedback

#8 Updated by Salvatore Larosa over 9 years ago

Yes, after 211d28b and 8cdf0d6 it is working for me.

#9 Updated by Nyall Dawson over 9 years ago

  • Status changed from Feedback to Open

I'm still getting issues with the tool. Just tried with aa6db0 doing a reshape on a simple multipolygon (exact same process as demonstrated in the earlier screencast) and QGIS crashed with the error:

qgis: geos_ts_c.cpp:4014: geos::geom::Geometry* GEOSGeom_clone_r(GEOSContextHandle_t, const geos::geom::Geometry*): Assertion `0 != g' failed.

#10 Updated by Nyall Dawson over 9 years ago

Relevant portion of the backtrace:

#0  0x00007fffef9cd267 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55
        resultvar = 0
        pid = 17026
        selftid = 17026
#1  0x00007fffef9ceeca in __GI_abort () at abort.c:89
        save_stage = 2
        act = {__sigaction_handler = {sa_handler = 0x4, sa_sigaction = 0x4}, sa_mask = {__val = {140737488340848, 140737488350695, 140737488340928, 51539593488, 140736616558592, 140737214840872, 140737235047916, 140737235052672, 20863760, 140737488343680, 140737213745308, 140737214859776, 140737214840872, 5, 140737213232304, 140737214825001}}, sa_flags = -871796736, sa_restorer = 0x7fffefb28028}
        sigs = {__val = {32, 0 <repeats 15 times>}}
#2  0x00007fffef9c603d in __assert_fail_base (fmt=0x7fffefb28028 "%s%s%s:%u: %s%sAssertion `%s' failed.\
%n", assertion=assertion@entry=0x7ffff0e6d5ec "0 != g", file=file@entry=0x7ffff0e6d508 "geos_ts_c.cpp", line=line@entry=4014, function=function@entry=0x7ffff0e6e880 "geos::geom::Geometry* GEOSGeom_clone_r(GEOSContextHandle_t, const geos::geom::Geometry*)") at assert.c:92
        str = 0x1b46300 "\\360\\036s\\001" 
        total = 4096
#3  0x00007fffef9c60f2 in __GI___assert_fail (assertion=0x7ffff0e6d5ec "0 != g", file=0x7ffff0e6d508 "geos_ts_c.cpp", line=4014, function=0x7ffff0e6e880 "geos::geom::Geometry* GEOSGeom_clone_r(GEOSContextHandle_t, const geos::geom::Geometry*)") at assert.c:101
No locals.
#4  0x00007ffff0e65653 in GEOSGeom_clone_r () from /usr/lib/libgeos_c.so.1
No symbol table info available.
#5  0x00007ffff42bdefc in QgsGeos::reshapeGeometry (this=0x7fffffffca30, reshapeWithLine=..., errorCode=0x7fffffffca1c) at /home/nacho/dev/QGIS/src/core/geometry/qgsgeos.cpp:1561
        i = 0
        reshapeTookPlace = false
        currentReshapeGeometry = 0x0
        newGeoms = 0x41f8480
        newMultiGeom = 0x7ffff42b78a0 <QgsGeos::cacheGeos() const+56>
        isMultiGeom = true
        isLine = false
        reshapeLineGeos = 0x3f48440
        numGeoms = 1
        geosTypeId = 6
#6  0x00007ffff42a532c in QgsGeometry::reshapeGeometry (this=0x10cb290, reshapeWithLine=...) at /home/nacho/dev/QGIS/src/core/geometry/qgsgeometry.cpp:701
        reshapeLineString = {<QgsCurveV2> = {<QgsAbstractGeometryV2> = {_vptr.QgsAbstractGeometryV2 = 0x7ffff46bc9d0 <vtable for QgsLineStringV2+16>, mWkbType = QgsWKBTypes::LineString, mBoundingBox = {xmin = 0, ymin = 0, xmax = 0, ymax = 0}}, <No data fields>}, mCoords = {<QVector<QPointF>> = {{d = 0x1483f10, p = 0x1483f10}}, <No data fields>}, mZ = {{d = 0xe9d7c0 <QVectorData::shared_null>, p = 0xe9d7c0 <QVectorData::shared_null>}}, mM = {{d = 0xe9d7c0 <QVectorData::shared_null>, p = 0xe9d7c0 <QVectorData::shared_null>}}}
        geos = {<QgsGeometryEngine> = {_vptr.QgsGeometryEngine = 0x7ffff46bc510 <vtable for QgsGeos+16>, mGeometry = 0x18dad40}, mGeos = 0x15eed58, mGeosPrepared = 0x0}
        errorCode = 0
        geom = 0x1134d90
        reshapeLine = {{p = {static shared_null = {ref = {_q_value = 1}, alloc = 0, begin = 0, end = 0, sharable = 1, array = {0x0}}, d = 0x19a82d0}, d = 0x19a82d0}}
#7  0x0000000000699033 in QgsMapToolReshape::canvasMapReleaseEvent (this=0x16421f0, e=0x16fb500) at /home/nacho/dev/QGIS/src/app/qgsmaptoolreshape.cpp:97
        geom = 0x10cb290
        firstPoint = {m_x = 0.16851441241685139, m_y = -0.11086474501108645}
        fit = {mIter = 0x1134d90}
        bbox = {xmin = 0.13303769401330379, ymin = -0.75831485587583147, xmax = 0.90909090909090917, ymax = -0.11086474501108645}
        f = {_vptr.QgsFeature = 0x7ffff46b6e50 <vtable for QgsFeature+16>, d = {d = 0x17354f0}}
        reshapeReturn = 0
        reshapeDone = false
        vlayer = 0x4371810

#11 Updated by Nyall Dawson over 9 years ago

(Sorry for flooding this report). I've tracked down what triggers this - it's when the reshape line is invalid. eg, a linestring which starts inside the polygon and ends outside it. I've attached a screencast of a reshape operation which triggers the crash

#13 Updated by Nyall Dawson over 9 years ago

  • Status changed from Open to Closed

Confirmed fixed with the addition of 2948c45cba7358713e940b87ce0519185f6b0cc2

Also available in: Atom PDF