Hello, in my plugin I set up a rasterlayer like this:
QgsRasterLayer* lyr = new QgsRasterLayer(src->Dir + "/" + src->File, firstTBLayer->Title, QStringLiteral("gdal")); if (lyr->isValid()) QgsProject::instance()->addMapLayers(QList<QgsMapLayer *>() << lyr, false); The layer is valid and in a next step I ask for the renderer ... qgis crashes because of heap corruption. So I create a new renderer like this: QgsRasterRenderer* rend = new QgsMultiBandColorRenderer (rLyr->dataProvider(), redBand, greenBand, blueBand); rLyr->setRenderer(rend); In QGIS all seems to be OK but while closing QGIS it crashes again. If I ask for the renderer qDebug() << rLyr->renderer(); QGIS crashes with following messages: Ausnahme ausgelöst bei 0x00007ffd5369c3f0 in qgis-bin.exe: 0xC0000005: Zugriffsverletzung beim Lesen an Position 0x0000000000000030. Stack Trace: QgsRasterPipe::interface qgsrasterpipe.cpp:225 QgsRasterPipe::renderer qgsrasterpipe.cpp:239 QGISFunc::ReadRasterRuleSLD qgisfunc.cpp:1779 What is changing in my plugin while updating from qgis 2.18 to 3.10 ? The layer is added to legend after manipulating the renderer. In old plugin I manipulate renderer after adding it to legend. But this seems to be not the problem. Anyone who can help, please? Freundliche Grüße aus Leipzig Susann Schmidt Softwareentwicklung ************************************************************** GFI - Gesellschaft für Informationstechnologie mbH Philipp-Rosenthal-Straße 9 D-04103 Leipzig Geschäftsführer: Andreas Richter Amtsgericht Leipzig HRB 12054 USt.-IdNr.: DE179049354 Steuer-Nr.: 231/109/06412 ESRI Solution Partner und ER Mapper Reseller Tel. 0341 961 3310 Fax 0341 961 3311 Mail i...@gfi-gis.de Web www.gfi-gis.de und www.themenbrowser.de
_______________________________________________ QGIS-Developer mailing list QGIS-Developer@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer