In my opinion the problem is this:<div>The code to remove the element from the list is called every time, and the code to insert it is called only when &#39;surface&#39;. So in case surface is NULL the item won&#39;t be added, but will be removed next time the function is entered. Isn&#39;t that the case?</div>

<div><br></div><div>I don&#39;t have a detailed understanding of this exact code, but isn&#39;t the explanation as simple as that?</div><div>Should I add some debugging info to see if this is indeed the case, or you are sure that the problem lies somewhere else?</div>

<div><br></div><div>About the &#39;tagging&#39; -- are you proposing to add a boolean flag to the listener to explicitly mark it as &#39;in a list&#39; or &#39;out of a list&#39;?</div><div><br></div><div>Regards,</div><div>

Iskren<br><br></div><div><div class="gmail_quote">On Sat, Mar 12, 2011 at 9:48 PM, Marty Jack <span dir="ltr">&lt;<a href="mailto:martyj19@comcast.net">martyj19@comcast.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im"><br>
<br>
On 03/12/2011 02:20 PM, Bill Spitzak wrote:<br>
</div><div><div></div><div class="h5">&gt; On 03/12/2011 04:28 AM, Marty Jack wrote:<br>
&gt;&gt; I have never encountered a system where it was believed to be desirable to allow something to be removed twice.  It is important to keep data structures clean.  If anything you would be more likely to see a debugging mode where the lists were fully checked after every insert or remove to make sure they are internally consistent, especially if they are important to keeping the system running.  It&#39;s not that much different from memory allocation.  A block is allocated, or it is free, and a double free is a bug.<br>


&gt;<br>
&gt; Making it crash at the moment the second remove is attempted is better than it leaving the data corrupted and crashing later. It makes it a lot easier to find out why it went wrong.<br>
&gt;<br>
&gt; I think that is what the newest version of the patch is doing, right?<br>
&gt; _______________________________________________<br>
&gt; wayland-devel mailing list<br>
&gt; <a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
&gt; <a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
&gt;<br>
<br>
</div></div>Oh and no, the second version of the patch makes the second remove a no-op.<br>
<div><div></div><div class="h5">_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</div></div></blockquote></div><br></div>