This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 182697

Summary: ProjectTab.restoreTreeView() manipulates Swing components from RP thread
Product: projects Reporter: _ tboudreau <tboudreau>
Component: Generic Projects UIAssignee: Jesse Glick <jglick>
Status: RESOLVED FIXED    
Severity: normal CC: hmichel
Priority: P2 Keywords: RANDOM, THREAD
Version: 6.x   
Hardware: Macintosh (x86)   
OS: Mac OS X   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 182695    

Description _ tboudreau 2010-03-24 17:10:36 UTC
See thread dump attached to deadlock bug 182695

"Load Open Projects" daemon prio=1 tid=0x00000001438c7800 nid=0x15feff000 waiting for monitor entry [0x000000015fefe000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at java.awt.Container.remove(Container.java:1195)
	- waiting to lock <0x0000000108896600> (a java.awt.Component$AWTTreeLock)
	at org.netbeans.modules.project.ui.ProjectTab.restoreTreeView(ProjectTab.java:645)
	at org.netbeans.modules.project.ui.ProjectTab.propertyChange(ProjectTab.java:624)
	at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339)
	at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276)
	at org.netbeans.modules.project.ui.OpenProjectsTrampolineImpl.propertyChange(OpenProjectsTrampolineImpl.java:108)
	at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339)
	at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276)
	at org.netbeans.modules.project.ui.OpenProjectList$LoadOpenProjects.updateGlobalState(OpenProjectList.java:369)
	at org.netbeans.modules.project.ui.OpenProjectList$LoadOpenProjects.run(OpenProjectList.java:320)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1356)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1894)
Comment 1 Jesse Glick 2010-03-24 18:53:06 UTC
Surely not a P1, or there would have been other complaints long ago.
Comment 2 Jesse Glick 2010-03-24 19:02:21 UTC
core-main #306ab7682e60
Comment 3 Quality Engineering 2010-03-25 05:55:24 UTC
Integrated into 'main-golden', will be available in build *201003250201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/306ab7682e60
User: Jesse Glick <jglick@netbeans.org>
Log: #182697: manipulate AWT components on EQ only.
Comment 4 Jesse Glick 2010-03-31 21:56:58 UTC
*** Bug 181056 has been marked as a duplicate of this bug. ***
Comment 5 _ tboudreau 2010-04-01 07:03:37 UTC
Don't you want this line
+            final boolean someProjectsOpen = OpenProjects.getDefault().getOpenProjects().length > 0;
+            Mutex.EVENT.readAccess(new Runnable() {
+                public @Override void run() {
to be here?
+                    if (someProjectsOpen) {
+                        restoreTreeView();
+                    } else {
+                        showNoProjectsLabel();
+                    }
+                }
+            });
It's at least theoretically possible the value can change before the Runnable executes.
Comment 6 Jesse Glick 2010-04-01 14:36:05 UTC
(In reply to comment #5)
> the value can change before the Runnable executes.

It could, in which case I should get a new event and it should repaint. Just preferred to do the calculation outside EQ; not sure if it matters.