runelite-client: don't draw overlays on event dispatch thread
It is causing deadlocks as the client holds a lock on client in paint() at the time draw() is called, and the EDT then causes RSCanvas (which is the listener) to get triggered when the client draws onto the canvas, which goes back to client.paint() and deadlocks.
This commit is contained in:
@@ -26,8 +26,6 @@ package net.runelite.client.callback;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import javax.swing.SwingUtilities;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.api.Skill;
|
||||
@@ -90,24 +88,11 @@ public class Hooks
|
||||
|
||||
OverlayRenderer renderer = runelite.getRenderer();
|
||||
|
||||
assert !SwingUtilities.isEventDispatchThread();
|
||||
|
||||
try
|
||||
{
|
||||
SwingUtilities.invokeAndWait(() ->
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
renderer.render(image);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.warn("Error during overlay rendering", ex);
|
||||
}
|
||||
});
|
||||
renderer.render(image);
|
||||
}
|
||||
catch (InterruptedException | InvocationTargetException ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.warn("Error during overlay rendering", ex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user