Bug report #14025

Crash when loading project with custom renderer for vector layers

Added by Alexander Bruy almost 2 years ago. Updated almost 2 years ago.

Status:Closed
Priority:High
Assignee:Martin Dobias
Category:Python plugins
Affected QGIS version:master Regression?:No
Operating System:all Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:Yes

Description

I have custom renderer for vector layers, and can save project including information about this custom renderer. But when I try to open saved project QGIS crashes. Here is backtrace

#0  0x00000000ffffffff in ?? ()
#1  0x00007ffff54264d2 in QgsSymbolV2::mapUnitScale (this=0x7fff5c019040) at /home/alex/devel/cpp/qgis/src/core/symbology-ng/qgssymbolv2.cpp:274
#2  0x00007ffff542cba8 in QgsMarkerSymbolV2::renderPoint (this=0x7fff5c019040, point=..., f=0x7fff63dfdcb0, context=..., layerIdx=-1, selected=false)
    at /home/alex/devel/cpp/qgis/src/core/symbology-ng/qgssymbolv2.cpp:1251
#3  0x00007ffff542929b in QgsSymbolV2::renderFeature (this=0x7fff5c019040, feature=..., context=..., layer=-1, selected=false, drawVertexMarker=false, 
    currentVertexMarkerType=1, currentVertexMarkerSize=3) at /home/alex/devel/cpp/qgis/src/core/symbology-ng/qgssymbolv2.cpp:718
#4  0x00007ffff54a3602 in QgsFeatureRendererV2::renderFeatureWithSymbol (this=0xa8bbf0, feature=..., symbol=0x7fff5c019040, context=..., layer=-1, selected=false, 
    drawVertexMarker=false) at /home/alex/devel/cpp/qgis/src/core/symbology-ng/qgsrendererv2.cpp:283
#5  0x00007ffff54a3598 in QgsFeatureRendererV2::renderFeature (this=0xa8bbf0, feature=..., context=..., layer=-1, selected=false, drawVertexMarker=false)
    at /home/alex/devel/cpp/qgis/src/core/symbology-ng/qgsrendererv2.cpp:277
#6  0x00007fff70eb274e in sipQgsFeatureRendererV2::renderFeature (this=0xa8bbf0, a0=..., a1=..., a2=-1, a3=false, a4=false)
    at /home/alex/devel/cpp/qgis/build/python/core/sip_corepart1.cpp:37671
#7  0x00007ffff58291f9 in QgsVectorLayerRenderer::drawRendererV2 (this=0x2fd9780, fit=...) at /home/alex/devel/cpp/qgis/src/core/qgsvectorlayerrenderer.cpp:312
#8  0x00007ffff58289aa in QgsVectorLayerRenderer::render (this=0x2fd9780) at /home/alex/devel/cpp/qgis/src/core/qgsvectorlayerrenderer.cpp:249
#9  0x00007ffff57030c4 in QgsMapRendererCustomPainterJob::doRender (this=0x13e6bd0) at /home/alex/devel/cpp/qgis/src/core/qgsmaprenderercustompainterjob.cpp:251
#10 0x00007ffff5702d81 in QgsMapRendererCustomPainterJob::staticRender (self=0x13e6bd0) at /home/alex/devel/cpp/qgis/src/core/qgsmaprenderercustompainterjob.cpp:214
#11 0x00007ffff5705aeb in QtConcurrent::StoredFunctorCall1<void, void (*)(QgsMapRendererCustomPainterJob*), QgsMapRendererCustomPainterJob*>::runFunctor (
    this=0x2fd7320) at /usr/include/qt4/QtCore/qtconcurrentstoredfunctioncall.h:277
#12 0x00007ffff5703f5a in QtConcurrent::RunFunctionTask<void>::run (this=0x2fd7320) at /usr/include/qt4/QtCore/qtconcurrentrunbase.h:134
#13 0x00007ffff4bd3b80 in QThreadPoolThread::run (this=0x346cea0) at concurrent/qthreadpool.cpp:108
#14 0x00007ffff4be070f in QThreadPrivate::start (arg=0x346cea0) at thread/qthread_unix.cpp:349
#15 0x00007fffed60f0a4 in start_thread (arg=0x7fff63dff700) at pthread_create.c:309
#16 0x00007fffee40204d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Test plugin with custom renderer for point layers attached.

Seems there are some issues with interaction between Python bindings and C++ core code.

renderertest.tar.bz2 (4.12 KB) Alexander Bruy, 12/22/2015 06:26 AM

mytestrenderer.py Magnifier (3.22 KB) Martin Dobias, 01/25/2016 08:28 AM


Related issues

Related to QGIS Application - Bug report #13973: Crash when switching from custom renderer to another Closed 12/10/2015

Associated revisions

Revision 83eed110
Added by Martin Dobias almost 2 years ago

Improve renderer class documentation (refs #14025)

History

#1 Updated by Alessandro Pasotti almost 2 years ago

  • Assignee set to Martin Dobias

Not sure, but this could be the problem:

src/core/symbology-ng/qgssinglesymbolrendererv2.cpp:458

QgsSymbolV2List symbols = const_cast<QgsFeatureRendererV2 *>( renderer )->symbols( context );

the about to be cloned object is a sip object.

#2 Updated by Martin Dobias almost 2 years ago

  • Resolution set to invalid
  • Status changed from Open to Closed
  • File mytestrenderer.pyMagnifier added

The real issue was that symbols returned by the test renderer have not been initialized before being used in symbolForFeature().

Attached (fixed and simplified) version works fine for me - closing as invalid. I have some ideas how the situation could be improved in QGIS 3 so that custom renderer implementations are less crash-prone...

Also available in: Atom PDF