List iterating segfault
<p>I have a problem with list manipulations in C++, please be indulgent with me, I'm a beginner in this language.</p>

<p>So, I have a list created like that :</p>

<pre><code>list&lt;Auction&gt; MyAucList;
</code></pre>

<p>I construct somes objects and I put them in the list :</p>

<pre><code>Auction test(a, i); // a and i are int
MyAucList.push_back(test); // I put my objects in the list
</code></pre>

<p>Now, in the same function, I can iterate the list and get data from the objects as :</p>

<pre><code>for (list&lt;Auction&gt;::const_iterator it1 = MyAucList.begin(); it1 != MyAucList.end(); ++it1)
{
 if ((*it1).Getitem() == 118632)
   cout &lt;&lt; "FOUND !" &lt;&lt; endl;
}
</code></pre>

<p>This works as expected !</p>

<p>BUT, when I pass a reference to the list to antoher function :</p>

<pre><code>listHandling(MyAucList);
}

void     listHandling(list&lt;Auction&gt; &amp;MyAucList)
{
   for (list&lt;Auction&gt;::const_iterator it1 = MyAucList.begin(); it1 != MyAucList.end(); ++it1)
     {
        if ((*it1).Getitem() == 118632)
          cout &lt;&lt; "FOUND : " &lt;&lt; 118632 &lt;&lt; endl;
     }
}
</code></pre>

<p>I get a segfault :-(
I tried without using a reference, or with a pointer, but same result.
Do you have an idea about this problem?</p>

<p>Thanks for your help !</p>