Bug 103381 - Infinite viewer expand/restore when recursive data structure expanded
Summary: Infinite viewer expand/restore when recursive data structure expanded
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.1.1   Edit
Assignee: Kevin Barnes CLA Friend
QA Contact:
URL:
Whiteboard:
Keywords:
: 122991 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-07-11 15:43 EDT by Darin Wright CLA Friend
Modified: 2006-01-09 08:30 EST (History)
2 users (show)

See Also:


Attachments
patch (5.21 KB, patch)
2005-07-13 17:38 EDT, Kevin Barnes CLA Friend
no flags Details | Diff
refinement (4.86 KB, patch)
2005-07-26 12:02 EDT, Darin Wright CLA Friend
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Wright CLA Friend 2005-07-11 15:43:44 EDT
3.1

Debug to a breakpoint and expand variables to make a recursive data structure 
visible. Terminate program and re-launch to the same breakpoint. The variables 
viewer will begin to infinitely expand the variables tree as it attempts to 
restore the expansion state of the viewer.

Example program. Set a breakpoint on the first line of the main method. Step 
thru a few lines, expand variables & terminate. Re-launch to the same 
breakpoint to see the problem.

package a.b.c;

import java.util.ArrayList;

public class RecursiveVars {

    /**
     * @param args
     */
    public static void main(String[] args) {
        ArrayList list = new ArrayList();
        list.add(list);
        list.add("one");
        list.add("two");
        list.add("three");
        System.out.println(list);
    }

}
Comment 1 Darin Wright CLA Friend 2005-07-12 10:38:11 EDT
Marking as 3.1.1 candidate
Comment 2 Kevin Barnes CLA Friend 2005-07-13 17:38:13 EDT
Created attachment 24703 [details]
patch

This is another case where we're broken because the tree viewer assumes that an
item will not be placed into a tree in more than one place. This time we try to
expand "foo",  and the wrong "foo" gets expanded.

Patch hacks the variables viewer to prevent this. It's an ugly work around
though. Will investigate better solutions (including fixing the tree) before
releasing any changes.
Comment 3 Kevin Barnes CLA Friend 2005-07-14 11:36:26 EDT
Problem is that we call TreeViewer.expandToLevel(object, level) and object
exists in the tree in many places. The tree viewer keeps finding the wrong one
which triggers the retrieval of more children (loop).
Comment 4 Darin Wright CLA Friend 2005-07-26 12:02:23 EDT
Created attachment 25299 [details]
refinement

Please take a look at the following patch. It modifies the fix by avoiding the
creation of new arrays. As well, the top level loop to iterate thru segments is
not required, as it is a top down traversal.
Comment 5 Kevin Barnes CLA Friend 2005-07-26 16:52:46 EDT
looks good to me
Comment 6 Darin Wright CLA Friend 2005-07-27 09:22:15 EDT
Released fix to 3.1.1
Comment 7 Darin Wright CLA Friend 2005-07-27 09:26:11 EDT
Released to HEAD
Comment 8 Darin Wright CLA Friend 2006-01-09 08:30:55 EST
*** Bug 122991 has been marked as a duplicate of this bug. ***