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.57k stars 3k forks source link

crash when using clipped multipolygon as an atlas #44545

Closed esnyder-rve closed 2 years ago

esnyder-rve commented 3 years ago

What is the bug or the crash?

User Feedback

Exporting an atlas. Crashes on page 2 everytime.

Report Details

Crash ID: 67009ff624ac1498787aaa039193b39195dfccc2

Stack Trace

QgsMapToPixelSimplifier::operator= :
QgsSymbol::renderFeature :
QgsFeatureRenderer::renderFeature :
QgsVectorLayerJoinInfo::setEditable :
QgsVectorLayerJoinInfo::setEditable :
QgsVectorLayerJoinInfo::setEditable :
QgsMapRendererCustomPainterJob::doRender :
QgsMapRendererCustomPainterJob::startPrivate :
QgsMapRendererCustomPainterJob::renderSynchronously :
QgsLayoutItemMap::drawMap :
QgsLayoutItemMap::paint :
QGraphicsScene::dragMoveEvent :
QGraphicsScene::drawItems :
QGraphicsScene::drawItems :
QGraphicsScene::render :
QgsLayoutExporter::renderRegion :
QgsLayoutExporter::renderPage :
QgsLayoutExporter::printPrivate :
QgsLayoutExporter::exportToPdf :
QgsLayoutExporter::exportToPdfs :
QgsMapToolRotateLabel::setRotationPreviewBox :
QObject::qt_static_metacall :
QAction::activate :
QMenu::actionGeometry :
QMenu::actionGeometry :
QMenu::mouseReleaseEvent :
QWidget::event :
QMenu::event :
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 :
QMenu::exec :
QToolButton::paintEvent :
QToolButton::showMenu :
QToolButton::mousePressEvent :
QWidget::event :
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 :

QGIS Info QGIS Version: 3.20.1-Odense QGIS code revision: 1c3c5cd6 Compiled against Qt: 5.15.2 Running against Qt: 5.15.2 Compiled against GDAL: 3.3.1 Running against GDAL: 3.3.1

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

Steps to reproduce the issue

Created a new layout for a map book. Export PDF Crash on page 2

Versions

QGIS version 3.20.1-Odense QGIS code revision 1c3c5cd6 Qt version 5.15.2 Python version 3.9.5 GDAL/OGR version 3.3.1 PROJ version 8.1.0 EPSG Registry database version v10.027 (2021-06-17) GEOS version 3.9.1-CAPI-1.14.2 SQLite version 3.35.2 PDAL version 2.3.0 PostgreSQL client version 13.0 SpatiaLite version 5.0.1 QWT version 6.1.3 QScintilla2 version 2.11.5 OS version Windows 10 Version 2009

Active Python plugins actions_for_relations annotationManager cartography_tools create_layer_from_selected_features firstaid FreehandRasterGeoreferencer Go2NextFeature3 joinmultiplelines latlontools LayerStyleLoader loadthemall MemoryLayerSaver mmqgis monokai MultipleLayerSelection multiple_layers_tools PluginLoadTimes polystrip powerpan processing_fusion processing_taudem qlyrx QNeighborhood qrbarcodeitem QuickMultiAttributeEdit3 QuickOSM redLayer searchlayers SelectWithin Serval slyr_community Submission db_manager processing

Additional context

I'll debug it tomorrow and try to see what's going on.

gioman commented 3 years ago

@esnyder-rve try on a new QGIS profile, no 3rd party plugins installed. If the problem persist please attach a sample project we can use to replicate the issue.

esnyder-rve commented 3 years ago

The clean profile did not work (no surprise there). I get this kind of problem a almost every time when upgrading a project. Creating a new project usually fixes these issues (will test). It'd be nice if I don't have to redo every single project every single time there's a new QGIS release.

Here's some debugging info though:

For some reason, in this line: https://github.com/qgis/QGIS/blob/1c3c5cd677f79644033f0671557bfcdd6338e3a3/src/core/symbology/qgssymbol.cpp#L1168 geomCollection is nullptr, and line 1169 throws an access violation exception.

Here's VS's message: Exception thrown at 0x00007FFBE928C068 (qgis_core.dll) in qgis-bin.exe: 0xC0000005: Access violation reading location 0x0000000000000010.

Also, this line should have triggered, but wasn't: https://github.com/qgis/QGIS/blob/1c3c5cd677f79644033f0671557bfcdd6338e3a3/src/core/symbology/qgssymbol.cpp#L1074 because processedGeometry is also nullptr

esnyder-rve commented 3 years ago

This does exist for newly created projects. I figured out that it involves clipping layers to the atlas feature.

esnyder-rve commented 3 years ago

And, I found the layer. I have a waterbodies layer hosted on PostGIS that causes the crash (only when being clipped by the atlas feature in the layout).

gioman commented 3 years ago

And, I found the layer. I have a waterbodies layer hosted on PostGIS that causes the crash (only when being clipped by the atlas feature in the layout).

@esnyder-rve can you share it?

esnyder-rve commented 3 years ago

It's a large state-wide dataset for New Jersey. Here's the link for it (I know it's old, the state hasn't updated it, nor moved it to it's new GIS site): https://www.nj.gov/dep/gis/nhd2002.html

roya0045 commented 2 years ago

Could the title of the issue made more descriptive (crash when using clipped multipolygon as an atlas) or something similar?

gioman commented 2 years ago

Could the title of the issue made more descriptive (crash when using clipped multipolygon as an atlas) or something similar?

@roya0045 done!

roya0045 commented 2 years ago

@gioman Thank you gio!

nyalldawson commented 2 years ago

I believe this one is fixed in newer releases -- can you please re-test?

esnyder-rve commented 2 years ago

@nyalldawson It does appear to be fixed. I just tested it with the layer that caused the crash, and got no crash!