Bug report #12009
Creating new QgsComposerHtml from Python causes segmentation fault
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||Yes||Copied to github as #:||20212|
The QgsComposerHtml class behaves bad from Python.
When a new QgsComposerHtml is instantiated I get a segmentation fault and QGIS crashes.
Something wrong happens even when one tries to obtain an existing object from a composition:
mycomp.getComposerItemById('myhtml') -> QgsComposerFrame instance
I don't understand how a QgsComposerFrame is returned given that QgsComposerHtml is not related to this class. It derives from QgsComposerMultiFrame, and in case it can contains frame objects...
It happens both on 2.6 and master, both on Linux and Windows.
#1 Updated by Giovanni Allegri over 5 years ago
I've noticed this line: https://github.com/qgis/QGIS/blob/master/src/core/composer/qgscomposerhtml.cpp#L89
It passes a null QgsComposition pointer to QgsComposerMultiFrame constructor, but within its constructor it doesn't check the pointer from not being null: https://github.com/qgis/QGIS/blob/master/src/core/composer/qgscomposermultiframe.cpp#L27
The crash happens here.