Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 161040

Summary: DeferredUpdateManager performValidation does not support reentry
Product: [Tools] GEF Reporter: Stefan Holzknecht <s.holzknecht>
Component: GEF-Legacy Draw2dAssignee: gef-inbox <gef-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: aboyko, hudsonr
Version: 3.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Stefan Holzknecht CLA 2006-10-16 08:27:40 EDT
When creating an edge or relationship my editor sometimes hangs. This happens if the relations gets revalidated and the mouse is over a figure that is a child of the connection layer. Debbuging my editor I noted that the List of invalidFigures  grows indefinite. It seams that in performUpdate the addInvalidFigure() gets called. But sadly the list does not contain the actually validated figure anymore  and the deadlock occures. In my update manager the figure gets unset after the validation and everything seams to be ok. 

    /**
     * @see UpdateManager#performValidation()
     */
    public void performValidation() {
        if (invalidFigures.isEmpty())
            return;
        try {
            IFigure fig;
            fireValidating();
            for (int i = 0; i < invalidFigures.size(); i++) {
                fig = (IFigure) invalidFigures.get(i);
                fig.validate();               // changed
                invalidFigures.set(i, null);  // changed
             }
        } finally {
            invalidFigures.clear();
        }
    }
Comment 1 Randy Hudson CLA 2006-10-16 09:30:51 EDT
I have seen this problem recently too.

In my case, when I was placing a cell editor, I was forcing the figure below to layout before placing the celleditor on top of it. But, a layout was already in progress, so you get the NPE.

But, what is the correct fix? You can't request a layout if one is ongoing, so should the method just return without laying out? That doesn't make much sense either. A third approach would be for the code invoking performValidation to instead call runWithUpdate(Runnable).

Can you provide more details about your use case? Please look at your stack trace, and post the amount that includes the first call to performValidation(), and a brief description.
Comment 2 Alex Boyko CLA 2008-04-25 15:55:05 EDT
This should be fixed by the fix to bug 146894