matthiasblaesing commented on issue #995: [NETBEANS-1419] fix for Assertion 
Error while editing project libraries
URL: 
https://github.com/apache/incubator-netbeans/pull/995#issuecomment-435538455
 
 
   I think the changed assert just works around the problem: _Swing requires 
all interaction with components to be done on the EDT_. This requirement is 
obviously violated (the implementation in `SwingUtilities.java` in the JDK 
looks sane).
   
   But looking at the stack trace the problem seems to be in the 
`ActionInvoker`. This is the code:
   
   ```java
       private static void doPerformAction(Action action, final 
ActionInvoker.ActionRunnable r) {
           assert java.awt.EventQueue.isDispatchThread() : "Action " + 
action.getClass().getName() +
           " may not be invoked from the thread " + 
Thread.currentThread().getName() +
           ", only the event queue: 
http://www.netbeans.org/download/4_1/javadoc/OpenAPIs/apichanges.html#actions-event-thread";;
   
           if (r.async && !r.needsToBeSynchronous()) {
               Runnable r2 = new Runnable() {
                       public void run() {
                           r.doRun();
                       }
                   };
   
               RP.post(r2);
           } else {
               r.run();
           }
       }
   ```
   
   The stack trace shows, that the first branch is taken, so this is a 
threading violation and modifying the assert just plasters over that fact. 
Netbeans has several places, that have similar problems and an easy way to find 
them is to run with substance LAF.
   
   IMHO: The assert needs to stay as it was. For the end user builds this is a 
non-problem, as the production builds have assertions disabled. The real fix 
would be to move Swing interaction into the EDT.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to