OK, I see. Thank you very much. Cheers, Luca
2016-09-03 19:30 GMT+02:00 Alessandro Pasotti <[email protected]>: > > On Sat, Sep 3, 2016 at 5:09 PM, Luca Congedo <semiautomatic.blogger@gmail. > com> wrote: > >> I think I found the cause of the issue when trying to remove a layer that >> was already removed. >> To reproduce in Python console: >> # add raster >> l1 = >> qgis.utils.iface.addRasterLayer("C:\Users\a\Desktop\LC81900312013105LGN01_B2.tif", >> "raster1") >> >> remove manually the raster >> >> # try to remove the raster >> QgsMapLayerRegistry.instance().removeMapLayer(l1.id()) >> >> QGIS crashes >> >> Cheers, >> Luca >> >> >> > > Hi, I believe that this is not something we can fix easily: removing the > layer from the map registry deletes the layer removing the object from > memory but the python variable still points to an object that was deleted, > of course it crashes. > > There are many other similar ways you can make QGIS crash, this is due to > the nature of Python - C++ bindings and there is not much we can do, the > Python programmers should take care to avoid such potentially dangerous > situations. > > You might want to use the sip API directly if you want to check for > deleted objects: > http://pyqt.sourceforge.net/Docs/sip4/python_api.html > > Hope this helps. > > Cheers > > > >> 2016-09-03 11:57 GMT+02:00 Luca Congedo <[email protected]> >> : >> >>> Hi Matthias, >>> >>> yes, it happens in Windows when removing the group manually (it seems >>> that Linux is not affected). >>> I had a button in the plugin for removing the temporary rasters which I >>> have now disabled in a plugin update. >>> >>> Luca >>> >>> >>> 2016-09-03 11:53 GMT+02:00 Matthias Kuhn <[email protected]>: >>> >>>> Hi Luca, >>>> >>>> does it also happen when you do the same process manually? >>>> >>>> Matthias >>>> >>>> On 09/03/2016 11:43 AM, Luca Congedo wrote: >>>> > Hello everybody, >>>> > >>>> > removing a group (created by the Semi-Automatic Classification Plugin) >>>> > containing rasters from QGIS layers causes a crash. >>>> > To reproduce, if you create 2 or more classification previews with the >>>> > Semi-Automatic Classification Plugin and then remove the group >>>> > 'Class_temp_group' from the layers. >>>> > Is there anything I can do at the plugin level, or should I open a >>>> ticket? >>>> > >>>> > Thank you, >>>> > Luca >>>> > >>>> > >>>> > _______________________________________________ >>>> > Qgis-developer mailing list >>>> > [email protected] >>>> > List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer >>>> > Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer >>>> > >>>> _______________________________________________ >>>> Qgis-developer mailing list >>>> [email protected] >>>> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer >>>> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer >>> >>> >>> >> >> _______________________________________________ >> Qgis-developer mailing list >> [email protected] >> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer >> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer >> > > > > -- > Alessandro Pasotti > w3: www.itopen.it >
_______________________________________________ Qgis-developer mailing list [email protected] List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
