GNOME Bugzilla – Bug 758242
Swing threading rule is broken
Last modified: 2019-05-29 10:53:16 UTC
"All Swing components and related classes, unless otherwise documented, must be accessed on the event dispatching thread." http://docs.oracle.com/javase/8/docs/api/javax/swing/package-summary.html java-atk-wrapper breaks this rule. For instance, the AtkText's ctor: public AtkText (AccessibleContext ac) { super(); this.ac = ac; this.acc_text = ac.getAccessibleText(); } It calls a method right on an AccessibleContext object, whereas the ctor itself is called from: jawtext.c: jaw_text_data_init That is, from the java-atk-wrapper main thread. Some apps rely on the Swing threading rule (for instance, in their synchronization model) and can be strict about following it. One of such apps is IntelliJ IDEA Java IDE, which throws exceptions like the following: Read access is allowed from event dispatch thread or inside read-action only (see com.intellij.openapi.application.Application.runReadAction()) Details: Current thread: Thread[Thread-1,5,main] 1276501196 ; dispatch thread: false; isDispatchThread(): false SystemEventQueueThread: Thread[AWT-EventQueue-1 15.0#IC-143.379.11, eap:true,6,main] 927664267 java.lang.Throwable at com.intellij.openapi.diagnostic.Logger.error(Logger.java:126) at com.intellij.openapi.application.impl.ApplicationImpl.assertReadAccessAllowed(ApplicationImpl.java:1047) at com.intellij.util.indexing.FileBasedIndexImpl.ensureUpToDate(FileBasedIndexImpl.java:810) at com.intellij.util.indexing.FileBasedIndexImpl.ensureUpToDate(FileBasedIndexImpl.java:801) at com.intellij.psi.stubs.StubIndexImpl.doProcessStubs(StubIndexImpl.java:242) at com.intellij.psi.stubs.StubIndexImpl.processElements(StubIndexImpl.java:223) at com.intellij.psi.stubs.StubIndex.getElements(StubIndex.java:145) at com.intellij.psi.stubs.StubIndex.getElements(StubIndex.java:135) at com.intellij.psi.impl.java.stubs.index.JavaFullClassNameIndex.get(JavaFullClassNameIndex.java:48) at com.intellij.psi.impl.file.impl.JavaFileManagerImpl.findClassInIndex(JavaFileManagerImpl.java:122) at com.intellij.psi.impl.file.impl.JavaFileManagerImpl.findClass(JavaFileManagerImpl.java:115) at com.intellij.psi.impl.PsiElementFinderImpl.findClass(PsiElementFinderImpl.java:54) at com.intellij.psi.impl.JavaPsiFacadeImpl.doFindClass(JavaPsiFacadeImpl.java:124) at com.intellij.psi.impl.JavaPsiFacadeImpl.findClass(JavaPsiFacadeImpl.java:101) at com.intellij.execution.JavaExecutionUtil.findMainClass(JavaExecutionUtil.java:178) at com.intellij.execution.JavaExecutionUtil.findMainClass(JavaExecutionUtil.java:168) at com.intellij.execution.util.JavaParametersUtil.isClassInProductionSources(JavaParametersUtil.java:94) at com.intellij.execution.ui.DefaultJreSelectorKt.isClassInProductionSources(DefaultJreSelector.kt:115) at com.intellij.execution.ui.DefaultJreSelectorKt.access$isClassInProductionSources(DefaultJreSelector.kt:1) at com.intellij.execution.ui.DefaultJreSelector$SdkFromSourceRootDependencies$1.invoke(DefaultJreSelector.kt:100) at com.intellij.execution.ui.DefaultJreSelector$SdkFromSourceRootDependencies$1.invoke(DefaultJreSelector.kt:99) at com.intellij.execution.ui.DefaultJreSelector$SdkFromModuleDependencies.getNameAndDescription(DefaultJreSelector.kt:82) at com.intellij.execution.ui.DefaultJreSelector.getDescriptionString(DefaultJreSelector.kt:69) at com.intellij.execution.ui.JrePathEditor$DefaultJreItem.render(JrePathEditor.java:275) at com.intellij.execution.ui.JrePathEditor$2.doCustomize(JrePathEditor.java:111) at com.intellij.execution.ui.JrePathEditor$2.doCustomize(JrePathEditor.java:108) at com.intellij.ui.ColoredListCellRendererWrapper.customizeCellRenderer(ColoredListCellRendererWrapper.java:29) at com.intellij.ui.ColoredListCellRenderer.getListCellRendererComponent(ColoredListCellRenderer.java:75) at com.intellij.openapi.ui.ComboBoxWithWidePopup$AdjustingListCellRenderer.getListCellRendererComponent(ComboBoxWithWidePopup.java:120) at javax.swing.JList$AccessibleJList$AccessibleJListChild.getComponentAtIndex(JList.java:3227) at javax.swing.JList$AccessibleJList$AccessibleJListChild.getCurrentAccessibleContext(JList.java:3208) at javax.swing.JList$AccessibleJList$AccessibleJListChild.getAccessibleText(JList.java:3394) at org.GNOME.Accessibility.AtkText.<init>(AtkText.java:47)
I believe this is fixed by the work pushed for 0.35.0