Bug report #14025

Crash when loading project with custom renderer for vector layers

Added by Alexander Bruy over 1 year ago. Updated over 1 year ago.

Status:Closed Start Date:12/22/2015
Priority:High Due date:
Assigned to:Martin Dobias % Done:


Category:Python plugins and bindings
Target version:Future Release - High Priority
Platform:all Pull Request or Patch supplied:No
Platform version: Affected version:master
Status info: Causes crash or corruption:Yes
Resolution:invalid Tag:


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.1 kB) Alexander Bruy, 12/22/2015 06:26 am

mytestrenderer.py (3.2 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 83eed1109c514ff6001f9b01fd77f9fada1a8b7a
Added by Martin Dobias over 1 year ago

Improve renderer class documentation (refs #14025)


Updated by Alessandro Pasotti over 1 year ago

  • Assigned to set to Martin Dobias

Not sure, but this could be the problem:


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

the about to be cloned object is a sip object.

Updated by Martin Dobias over 1 year ago

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

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