Hi Michele.<br><br>I guess you must update the canvas layer set after remove a layer from QgsMapLayerRegistry.<br><br><br>Germán Carrillo<br><br><br><div class="gmail_quote">2009/10/8 Michele Mammini <span dir="ltr">&lt;<a href="mailto:mamminim@yahoo.it">mamminim@yahoo.it</a>&gt;</span><br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
Like in the subject I solved a part of my problem.<br><br>
The correct code to remove the layer from QGis is:<br>
<font face="Courier New, Courier">     currentLayer =
<i>self</i>.iface.activeLayer()<br>
     RegIns = QgsMapLayerRegistry.instance()<br>
    
RegIns.removeMapLayer(currentLayer.getLayerID())<br><br>
</font>but it working if i use it in Python Console, while QGis crash if
I use it in my plugin code<br><br>
<br><br>
<br>
Dear All,<br><br>
i have a problem with QgsMapLayerRegistry class when i try to remove a
Layer from QGis.<br><br>
i use this two code line:<br>
<font face="Courier New, Courier">     RegIns =
QgsMapLayerRegistry.instance()<br>
     RegIns.removeMapLayer(layerName)<br><br>
</font>where layerName is set with this command line:
<font face="Courier New, Courier">layerName =
<i>self</i>.iface.activeLayer().name()<br><br>
</font>Do someone know how to solve it?<br><br>
Thank you Michele.<br>
</div>

<br>_______________________________________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
<br></blockquote></div>-- <br>-----------<br>   |\__  <br>(:&gt;__)(<br>   |/    <br><br>Soluciones Geoinformáticas Libres                            <br><a href="http://geotux.tuxfamily.org/">http://geotux.tuxfamily.org/</a><br>

<br>