« Return to Thread: [Issue 447] New - ThreadProxyEventList.clear() fails

[Issue 447] ThreadProxyEventList.clear() fails

by BRANDS-2 :: Rate this Message:

Reply to Author | View in Thread

https://glazedlists.dev.java.net/issues/show_bug.cgi?id=447






------- Additional comments from brands@... Sun Jun  8 13:43:40 +0000 2008 -------
Calling clear() on ThreadProxyList calls TransformedList.clear() :
    public void clear() {
        // nest changes and let the other methods compose the event
        updates.beginEvent(true);
        try {
            super.clear(); // AbstractEventList.clear()
        } finally {
            updates.commitEvent();
        }
    }

AbstractEventList.clear() uses SimpleIterator to remove the list elements one by
one. SimpleIterator uses source.size() to implement hasNext() method.

But ThreadProxylist.size() returns the size of the local cache, which is only
updated after commitEvent. So SimpleIterator sees the old wrong list size and
iterates "too far"...


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@...
For additional commands, e-mail: issues-help@...

 « Return to Thread: [Issue 447] New - ThreadProxyEventList.clear() fails

LightInTheBox - Buy quality products at wholesale price!