Bug 400755 - Issue with TreeModelViewer in Linux OS
Summary: Issue with TreeModelViewer in Linux OS
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf (show other bugs)
Version: 8.0.1   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-13 23:23 EST by malu CLA
Modified: 2020-09-04 15:24 EDT (History)
2 users (show)

See Also:


Attachments
Modified org.eclipse.cdt.examples.dsf.filebrowser that can reproduc the reported issue (27.40 KB, application/octet-stream)
2013-02-13 23:23 EST, malu CLA
no flags Details
a 'tar' format of previously added attachemet (170.00 KB, application/x-tar)
2013-02-18 01:00 EST, malu CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description malu CLA 2013-02-13 23:23:33 EST
Created attachment 227054 [details]
Modified org.eclipse.cdt.examples.dsf.filebrowser that can reproduc the reported issue

I have implemented a tree viewer using TreeModelViewer (Virtual type in Lazy mode). I could see a strange behavior while running in Linux OS . If ever I try to expand the tree items using the  API expandAll(), the tree starts blinking/flickering, if it fail to fetch the child nodes. But this behavior was not there in Windows.
 
I tried to debug the code, but it went deep into some infinite loop that always try to update the tree viewer. Please see below the relevant stack trace : 
 
Thread [main] (Suspended)        
OS._gtk_main_do_event(long) line: not available [native method]          
OS.gtk_main_do_event(long) line: 8422               
Display.eventProc(long, long) line: 1245                
OS._gdk_window_process_updates(long, boolean) line: not available [native method] 
OS.gdk_window_process_updates(long, boolean) line: 5511      
Tree(Control).update(boolean, boolean) line: 4975         
Tree(Control).update() line: 4966             
TreeModelViewer(TreeViewer).setExpanded(Item, boolean) line: 335  
TreeModelViewer(AbstractTreeViewer).internalExpandToLevel(Widget, int) line: 1757 
TreeModelViewer(AbstractTreeViewer).expandToLevel(Object, int) line: 1060 
TreeModelViewer(InternalTreeModelViewer).autoExpand(TreePath) line: 2063              
HasChildrenUpdate.performUpdate() line: 53
ViewerUpdateMonitor$1.runInUIThread(IProgressMonitor) line: 99       
UIJob$1.run() line: 95     
 
Steps to reproduce the same in the DSF samples provided (org.eclipse.cdt.examples.dsf.filebrowser). 

1. First I created an empty folder in Linux OS (Fedora 17) say /home/malu/emptyFolder

2. Now in the constructor of file FilesystemRootsVMNode.java, modified the run() method of  update() job so that the root node is 
      File[] files = new File[] {new File("/home/malu/EmptyFolder")};(instead of using API File.listRoots() )

3. Now in FileBrowserDialog.java class I create a sample button too.. along with the search text box. See the snippet below :
     final Button expandAll = new Button(area, SWT.PUSH);
           expandAll.setText("Expand Me");
           expandAll.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(SelectionEvent e) {
                     fViewer.setAutoExpandLevel(ITreeModelViewer.ALL_LEVELS);
                     fViewer.expandAll();
                }
           });

...

Now just run the code, it will show : /home/malu/emptyFolder as root node. Just try to push the "Expand Me" button. We can see the flickering/blinking issue.
Comment 1 Pawel Piech CLA 2013-02-15 10:57:17 EST
Hi Malu, what format is the attachment, if possible can you post a git patch?
Comment 2 Pawel Piech CLA 2013-02-15 11:00:41 EST
BTW, expanding all elements in a lazy-loading view is especially tricky.  For an example, take a look at BreakpointsView.expandAllElementsInViewer().

Still, calling TreeViewer.expandAll() shouldn't send us in an infinite loop... unless the tree has infinite depth ;-)
Comment 3 malu CLA 2013-02-18 00:59:30 EST
Hi Pawel,
I have re-attached a 'tar' format of the source since we are not using git here.
Also I cannot say the issue is with 'expandAll' only. As said in the previous mail, we have implemented a 'search' feature too. If the searched string is not present also the entire view starts flickering / blinking.
Comment 4 malu CLA 2013-02-18 01:00:09 EST
Created attachment 227176 [details]
a 'tar' format of previously added attachemet