Ok, so I applied the attached patch for debugging, and here is the output:<div><br></div><div><font class="Apple-style-span" face="'courier new', monospace"># move mouse IN flower</font></div><div><div><font class="Apple-style-span" face="'courier new', monospace">XXX surface NULL # move mouse OUT of flower </font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">XXX Prevented BAD THINGS FROM HAPPENING # move mouse IN flower again</font></div><div><font class="Apple-style-span" face="'courier new', monospace">XXX surface NULL # move mouse OUT of flower</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">XXX Prevented BAD THINGS FROM HAPPENING # move mouse IN flower again (etc ...)</font></div><div><span class="Apple-style-span" style="font-family: 'courier new', monospace; ">YYY surface NULL # move mouse out of wayland (it is running in X, so just move mouse outside of wayland window)</span></div>
<div><font class="Apple-style-span" face="'courier new', monospace">YYY Prevented BAD THINGS FROM HAPPENING # move mouse IN wayland window</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br>
</font></div><div>So I thing this clarifies and proves to some extend my explanation in the previous email ;-)</div><div><br></div><div>Regards,</div><div>Iskren</div><br><div class="gmail_quote">On Sat, Mar 12, 2011 at 10:54 PM, Iskren Chernev <span dir="ltr"><<a href="mailto:iskren.chernev@gmail.com">iskren.chernev@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">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 'surface'. So in case surface is NULL the item won't be added, but will be removed next time the function is entered. Isn't that the case?</div>
<div><br></div><div>I don't have a detailed understanding of this exact code, but isn'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 'tagging' -- are you proposing to add a boolean flag to the listener to explicitly mark it as 'in a list' or 'out of a list'?</div><div><br></div><div>Regards,</div><div>
Iskren<font color="#888888"><br><br></font></div><div><div></div><div class="h5"><div><div class="gmail_quote">On Sat, Mar 12, 2011 at 9:48 PM, Marty Jack <span dir="ltr"><<a href="mailto:martyj19@comcast.net" target="_blank">martyj19@comcast.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><br>
<br>
On 03/12/2011 02:20 PM, Bill Spitzak wrote:<br>
</div><div><div></div><div>> On 03/12/2011 04:28 AM, Marty Jack wrote:<br>
>> 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's not that much different from memory allocation. A block is allocated, or it is free, and a double free is a bug.<br>
><br>
> 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>
><br>
> I think that is what the newest version of the patch is doing, right?<br>
> _______________________________________________<br>
> wayland-devel mailing list<br>
> <a href="mailto:wayland-devel@lists.freedesktop.org" target="_blank">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>
><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>_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org" target="_blank">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>
</div></div></blockquote></div><br></div>