qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.37k stars 2.98k forks source link

QGIS 3.28.11 crashes when translating or rotating a point layer #54819

Open twest820 opened 11 months ago

twest820 commented 11 months ago

What is the bug or the crash?

Report Details

Python Stack Trace

Windows fatal exception: access violation

Current thread 0x000016d0 (most recent call first):
<no Python frame>

Stack Trace

SpatialIndex::TPRTree::Data::Data :
qsort :
SpatialIndex::TPRTree::Data::Data :
SpatialIndex::TPRTree::Data::Data :
SpatialIndex::TPRTree::Data::Data :
SpatialIndex::TPRTree::Data::Data :
SpatialIndex::TPRTree::Data::Data :
SpatialIndex::TPRTree::Data::Data :
SpatialIndex::TPRTree::Data::Data :
SpatialIndex::TPRTree::Data::Data :
SpatialIndex::TPRTree::Data::Data :
QgsPointLocator::onFeatureDeleted :
QgsPointLocator::onGeometryChanged :
QObject::qt_static_metacall :
QgsVectorLayer::geometryChanged :
QObject::qt_static_metacall :
QgsVectorLayerEditBuffer::geometryChanged :
QUndoStack::push :
QgsVectorLayerEditBuffer::changeGeometry :
QgsVectorLayer::changeGeometry :
QgsMapToolRotateFeature::applyRotation :
QObject::qt_static_metacall :
QgsAngleMagnetWidget::angleEditingFinished :
QgsAngleMagnetWidget::eventFilter :
QCoreApplicationPrivate::sendThroughObjectEventFilters :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify :
QCoreApplication::notifyInternal2 :
QSizePolicy::QSizePolicy :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify :
QCoreApplication::notifyInternal2 :
QGuiApplicationPrivate::processKeyEvent :
QWindowSystemInterface::sendWindowSystemEvents :
QEventDispatcherWin32::processEvents :
qt_plugin_query_metadata :
QEventLoop::exec :
QCoreApplication::exec :
main :
BaseThreadInitThunk :
RtlUserThreadStart :

Report Details

Python Stack Trace

Windows fatal exception: access violation

Current thread 0x00000988 (most recent call first):
<no Python frame>

Stack Trace

SpatialIndex::TPRTree::Data::Data :
qsort :
SpatialIndex::TPRTree::Data::Data :
SpatialIndex::TPRTree::Data::Data :
SpatialIndex::TPRTree::Data::Data :
SpatialIndex::TPRTree::Data::Data :
SpatialIndex::TPRTree::Data::Data :
SpatialIndex::TPRTree::Data::Data :
SpatialIndex::TPRTree::Data::Data :
SpatialIndex::TPRTree::Data::Data :
SpatialIndex::TPRTree::Data::Data :
QgsPointLocator::onFeatureDeleted :
QgsPointLocator::onGeometryChanged :
QObject::qt_static_metacall :
QgsVectorLayer::geometryChanged :
QObject::qt_static_metacall :
QgsVectorLayerEditBuffer::geometryChanged :
QUndoStack::push :
QgsVectorLayerEditBuffer::changeGeometry :
QgsVectorLayer::changeGeometry :
QgsMapToolMoveFeature::cadCanvasReleaseEvent :
QgsMapToolAdvancedDigitizing::canvasReleaseEvent :
QgsMapCanvas::mouseReleaseEvent :
QWidget::event :
QFrame::event :
QGraphicsView::viewportEvent :
QCoreApplicationPrivate::sendThroughObjectEventFilters :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify :
QCoreApplication::notifyInternal2 :
QApplicationPrivate::sendMouseEvent :
QSizePolicy::QSizePolicy :
QSizePolicy::QSizePolicy :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify :
QCoreApplication::notifyInternal2 :
QGuiApplicationPrivate::processMouseEvent :
QWindowSystemInterface::sendWindowSystemEvents :
QEventDispatcherWin32::processEvents :
qt_plugin_query_metadata :
QEventLoop::exec :
QCoreApplication::exec :
main :
BaseThreadInitThunk :
RtlUserThreadStart :

System Info CPU Type: x86_64 Kernel Type: winnt Kernel Version: 10.0.19045

Steps to reproduce the issue

These crashes happen when translating or rotating a GeoPackage layer with 2403 points using the move feature and rotate feature tools from the toolbar.

  1. Start QGIS, open project, open layer for edit, select all points.
  2. Click tool.
  3. Make the edit (possibly zooming in to see more clearly).
  4. QGIS crashes.

Both crashes are frequent but do not appear to be completely guaranteed. So far if I type in a specific rotation a crash has always followed. Both crashes also occur in QGIS 3.22.14.

In #52877 @jgrocha suggests manually selecting all visible points in the layer and then checking for points which were not selected. In this case 2402 of the points get selected, leaving one point unselected. Unlike #52877, the problem point appears to have valid geometry and the crashes occur regardless of whether or not I put the layer through fix geometries. But, curiously, nothing happens if the point's selected in the attribute table and zoom to feature's chosen from the right click menu. The point's also not displayed next to the points it's actually next to.

I've been able to work around the crashes by recreating the one point and the deleting the original.

Versions

QGIS version 3.28.11-Firenze QGIS code revision b02458a196 Qt version 5.15.3 Python version 3.9.5 GDAL/OGR version 3.7.2 PROJ version 9.3.0 EPSG Registry database version v10.094 (2023-08-08) GEOS version 3.12.0-CAPI-1.18.0 SQLite version 3.41.1 PDAL version 2.5.5 PostgreSQL client version unknown SpatiaLite version 5.1.0 QWT version 6.1.6 QScintilla2 version 2.13.4 OS version Windows 10 Version 2009

Active Python plugins coordinate_capture 0.2 db_manager 0.1.20 grassprovider 2.12.99 MetaSearch 0.3.6 otbprovider 2.12.99 processing 2.12.99 sagaprovider 2.12.99

Supported QGIS version

New profile

Additional context

More user friendly behavior than an AV would be helpful. On the surface it seems clear the digitization tools would benefit from being more conservative in the assumptions they make about layer state—usually the expectation is input error checking should prevent AVs from happening.

However, the same select all but one issue occurs in the original shapefile created in Arc. So my guess here is the chain is more like

  1. An ESRI defect created a not quite valid .dbf.
  2. QGIS or GDAL failed to detect the malformed .dbf when exporting the shapefile to .gpkg.
  3. Fix geometries also isn't catching the issue.

I don't have permission to release the data here but if there's something I can do to inspect the problematic point more closely here let me know.

uclaros commented 11 months ago

Can you add a text field (or temporarily reuse one) and use the field calculator to set its value to geom_to_wkt(@geometry). What is the value calculated for the offending point?

twest820 commented 11 months ago

Oh good point, I should have thought to include that. The WKT's just

'Point (608731.37 4927015.68)'

which is the expected position (which is well within the CRS extents and is surrounded by non-problematic points on all sides). Also as expected, $x and $y in the field calculator return that location.