<div dir="ltr">OK, I see.<div>Thank you very much.</div><div><br></div><div>Cheers,</div><div>Luca</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-09-03 19:30 GMT+02:00 Alessandro Pasotti <span dir="ltr"><<a href="mailto:apasotti@gmail.com" target="_blank">apasotti@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><span class="">On Sat, Sep 3, 2016 at 5:09 PM, Luca Congedo <span dir="ltr"><<a href="mailto:semiautomatic.blogger@gmail.com" target="_blank">semiautomatic.blogger@gmail.<wbr>com</a>></span> wrote:<br></span><div class="gmail_quote"><span class=""><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div dir="ltr">I think I found the cause of the issue when trying to remove a layer that was already removed.<br><div>To reproduce in Python console:</div><div># add raster</div><div>l1 = qgis.utils.iface.addRasterLaye<wbr>r("C:\Users\a\Desktop\LC819003<wbr>12013105LGN01_B2.tif", "raster1")</div><div><br></div><div>remove manually the raster</div><div><br></div><div># try to remove the raster</div><div>QgsMapLayerRegistry.instance()<wbr>.removeMapLayer(<a href="http://l1.id" target="_blank">l1.id</a>())</div><div><br></div><div>QGIS crashes</div><div><br></div><div>Cheers,</div><div>Luca</div><div><div><div><br></div><div class="gmail_extra"><br></div></div></div></div></blockquote><div><br><br></div></span><div>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.<br><br></div><div>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.<br><br></div><div>You might want to use the sip API directly if you want to check for deleted objects:<br></div><div><a href="http://pyqt.sourceforge.net/Docs/sip4/python_api.html" target="_blank">http://pyqt.sourceforge.net/<wbr>Docs/sip4/python_api.html</a><br><br></div><div>Hope this helps.<br><br></div><div>Cheers<br></div><div><div class="h5"><div><br></div><div> </div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div dir="ltr"><div><div><div class="gmail_extra"><div class="gmail_quote">2016-09-03 11:57 GMT+02:00 Luca Congedo <span dir="ltr"><<a href="mailto:semiautomatic.blogger@gmail.com" target="_blank">semiautomatic.blogger@gmail.c<wbr>om</a>></span>:<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div dir="ltr">Hi Matthias,<div><br></div><div>yes, it happens in Windows when removing the group manually (it seems that Linux is not affected).<br>I had a button in the plugin for removing the temporary rasters which I have now disabled in a plugin update.</div><span><font color="#888888"><div><br></div></font></span><div><span><font color="#888888">Luca</font></span><div><div><br><div class="gmail_extra"><br><div class="gmail_quote">2016-09-03 11:53 GMT+02:00 Matthias Kuhn <span dir="ltr"><<a href="mailto:matthias@opengis.ch" target="_blank">matthias@opengis.ch</a>></span>:<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">Hi Luca,<br>
<br>
does it also happen when you do the same process manually?<br>
<br>
Matthias<br>
<div><div><br>
On 09/03/2016 11:43 AM, Luca Congedo wrote:<br>
> Hello everybody,<br>
><br>
> removing a group (created by the Semi-Automatic Classification Plugin)<br>
> containing rasters from QGIS layers causes a crash.<br>
> To reproduce, if you create 2 or more classification previews with the<br>
> Semi-Automatic Classification Plugin and then remove the group<br>
> 'Class_temp_group' from the layers.<br>
> Is there anything I can do at the plugin level, or should I open a ticket?<br>
><br>
> Thank you,<br>
> Luca<br>
><br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> Qgis-developer mailing list<br>
> <a href="mailto:Qgis-developer@lists.osgeo.org" target="_blank">Qgis-developer@lists.osgeo.org</a><br>
> List info: <a rel="noreferrer" href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman<wbr>/listinfo/qgis-developer</a><br>
> Unsubscribe: <a rel="noreferrer" href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman<wbr>/listinfo/qgis-developer</a><br>
><br>
______________________________<wbr>_________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org" target="_blank">Qgis-developer@lists.osgeo.org</a><br>
List info: <a rel="noreferrer" href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman<wbr>/listinfo/qgis-developer</a><br>
Unsubscribe: <a rel="noreferrer" href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman<wbr>/listinfo/qgis-developer</a></blockquote></div><br></div></div></div></div></div>
</blockquote></div><br></div></div></div></div>
<br>______________________________<wbr>_________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org" target="_blank">Qgis-developer@lists.osgeo.org</a><br>
List info: <a rel="noreferrer" href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman<wbr>/listinfo/qgis-developer</a><br>
Unsubscribe: <a rel="noreferrer" href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman<wbr>/listinfo/qgis-developer</a><br></blockquote></div></div></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><br>-- <br><div>Alessandro Pasotti<br>w3: <a href="http://www.itopen.it" target="_blank">www.itopen.it</a></div>
</font></span></div></div>
</blockquote></div><br></div>