Closed gkerdal closed 4 years ago
The UiThreadingViolationException comes from the fact that FilesTreeView.populateTree is called in the method doInBackground() of SwingWorker which is not in "Event Dispatch Thread" unlike the done method (https://docs.oracle.com/javase/tutorial/uiswing/concurrency/worker.html). Indirectly the reload of the tree done by Jajuk implies in substance some code that needs to be executed in this event dispatch thread.
One possible solution is to move the reload code in the "done()" method of SwingWorker in AbstractTreeView, but instead of doing that I was wondering what is the purpose of this reload, so I comment out these lines in FilesTreeView.populateTree and I don't get the problem :
// see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6472844 for a small memory leak that is caused here...
if (jtree != null && jtree.getModel() != null) {
((DefaultTreeModel) (jtree.getModel())).reload();
}
1) Doing that, the tree on the left side (FileTreeView) seems up-to-date when I edit property from TableFileWiew on the right side but do I miss something ?
2) the bug reference in the comment can be deleted since it refers to java 6.
Honestly, I can't remember but if you're confident with your change if if the referenced bug is fixed, go ahead and drop the code (please don't keep commented dead code).
Ok thanks. Of course I did not push commented code. I will have a deeper look at this behaviour because I see sometimes twice the collection items in the FileTreeView even if it seems to be independent of the reload.
Seems OK. The commented code is now deleted.
I run Jajuk 1.10.9 on Ubuntu 16.10, when I update tag information with property window, some views like FileTable and Queue view don't refresh properly.
Here is the console trace : 2016/12/11 19:03:10 [DEBUG] Starting Jajuk 1.10.9 Build: 1.10.9 (Debian) [main] (?:?)
2016/12/11 19:03:10 [DEBUG] Register: "PARAMETERS_CHANGE" by: org.jajuk.ui.helpers.FontManager@3ada9e37 [main] (?:?)
org.pushingpixels.substance.api.UiThreadingViolationException: State tracking must be done on Event Dispatch Thread
at org.pushingpixels.substance.internal.animation.StateTransitionTracker$ModelStateInfo.clear(StateTransitionTracker.java:166)
at org.pushingpixels.substance.internal.animation.StateTransitionTracker.(StateTransitionTracker.java:194)
at org.pushingpixels.substance.internal.ui.SubstanceTreeUI.getTracker(SubstanceTreeUI.java:1182)
at org.pushingpixels.substance.internal.ui.SubstanceTreeUI.access$1400(SubstanceTreeUI.java:89)
at org.pushingpixels.substance.internal.ui.SubstanceTreeUI$MyTreeSelectionListener.valueChanged(SubstanceTreeUI.java:701)
at javax.swing.tree.DefaultTreeSelectionModel.fireValueChanged(DefaultTreeSelectionModel.java:635)
at javax.swing.tree.DefaultTreeSelectionModel.clearSelection(DefaultTreeSelectionModel.java:577)
at javax.swing.tree.VariableHeightLayoutCache.rebuild(VariableHeightLayoutCache.java:758)
at javax.swing.tree.VariableHeightLayoutCache.treeStructureChanged(VariableHeightLayoutCache.java:644)
at javax.swing.plaf.basic.BasicTreeUI$Handler.treeStructureChanged(BasicTreeUI.java:3917)
at javax.swing.tree.DefaultTreeModel.fireTreeStructureChanged(DefaultTreeModel.java:580)
at javax.swing.tree.DefaultTreeModel.reload(DefaultTreeModel.java:297)
at javax.swing.tree.DefaultTreeModel.reload(DefaultTreeModel.java:212)
at org.jajuk.ui.views.FilesTreeView.populateTree(Unknown Source)
at org.jajuk.ui.views.AbstractTreeView$3.doInBackground(Unknown Source)
at org.jajuk.ui.views.AbstractTreeView$3.doInBackground(Unknown Source)
at javax.swing.SwingWorker$1.call(SwingWorker.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at javax.swing.SwingWorker.run(SwingWorker.java:334)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
2016/12/11 19:03:31 [ERROR] null / null [AWT-EventQueue-0] (?:?)
java.lang.NullPointerException
at org.jajuk.ui.helpers.PlaylistTableModel.populateModel(Unknown Source)
at org.jajuk.ui.helpers.JajukTableModel.populateModel(Unknown Source)
at org.jajuk.ui.views.QueueView.refreshQueue(Unknown Source)
at org.jajuk.ui.views.QueueView.access$500(Unknown Source)
at org.jajuk.ui.views.QueueView$8.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)