Skip to content

Commit

Permalink
Disable threaded caching of resource preview icons
Browse files Browse the repository at this point in the history
Temporary fix to prevent a deadlock in NI when accessing the resource
tree while the icon cache operation is still being performed in the
background.
  • Loading branch information
Argent77 committed Jul 21, 2023
1 parent 1a6c3f4 commit 07e83fa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/org/infinity/NearInfinity.java
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ public void windowClosing(WindowEvent event) {
e.printStackTrace();
}

cacheResourceIcons(true);
cacheResourceIcons(false);

statusBar = new StatusBar();
ResourceTreeModel treemodel = ResourceFactory.getResourceTreeModel();
Expand Down Expand Up @@ -922,7 +922,7 @@ public void refreshGame() {
containerpanel.revalidate();
containerpanel.repaint();
}
cacheResourceIcons(true);
cacheResourceIcons(false);
} finally {
blocker.setBlocked(false);
}
Expand Down Expand Up @@ -1527,6 +1527,7 @@ private void cacheResourceIcons(boolean threaded) {
// ensure that ongoing operations have ended before starting a new operation
cancelCacheResourceIcons();

// TODO: resolve deadlock when accessing resource tree while cache operation is performed
if (threaded) {
iconCacheWorker = new SwingWorker<Void, Void>() {
@Override
Expand Down

0 comments on commit 07e83fa

Please sign in to comment.