<div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">On Mon, Feb 7, 2011 at 12:40 PM, Federico J. Fernández<br>
<div class="im"><<a href="mailto:federico.fernandez@gmail.com">federico.fernandez@gmail.com</a>> wrote:<br>
</div><div class="im">> QgsFeatureList &featureList = this->currentLayer->selectedFeatures();<br>
<br>
</div>You only store reference to a temporary list returned by<br>
selectedFeatures(). That list is destroyed when that function<br>
terminates, so you have an invalid reference. Store the whole list<br>
instead, not just that reference:<br>
<br>
QgsFeatureList featureList = .... ;<br>
<br>
Your original post actually listed the correct version (without the<br>
reference '&'), that's why it wasn't clear where's your problem.<br>
<br>
By the way, QGIS contains a map tool for merging features (in<br>
src/app), so you could save your work by using that code instead of<br>
writing similar code again.<br>
<br></blockquote></div><br>Sorry for the mistake Martin, it gives an exception with and without the &.<br><br>I know about the QGIS tool, my version is copied from that code, but without some layer checks that are not neede in my application.<br>
<br>Thanks again for your help!<br><br>--<br>fede<br>