client: synchronize some calls to ImageIO.read()
ImageIO is not thread safe, see also 054dd4852d
This commit is contained in:
@@ -292,7 +292,11 @@ public class DiscordPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
final InputStream inputStream = response.body().byteStream();
|
final InputStream inputStream = response.body().byteStream();
|
||||||
final BufferedImage image = ImageIO.read(inputStream);
|
final BufferedImage image;
|
||||||
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
image = ImageIO.read(inputStream);
|
||||||
|
}
|
||||||
memberById.setAvatar(image);
|
memberById.setAvatar(image);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
@@ -33,12 +33,10 @@ import java.awt.Font;
|
|||||||
import java.awt.event.WindowAdapter;
|
import java.awt.event.WindowAdapter;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.ConnectException;
|
import java.net.ConnectException;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.security.GeneralSecurityException;
|
import java.security.GeneralSecurityException;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.BoxLayout;
|
import javax.swing.BoxLayout;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
@@ -52,8 +50,9 @@ import javax.swing.border.EmptyBorder;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.client.RuneLite;
|
import net.runelite.client.RuneLite;
|
||||||
import net.runelite.client.RuneLiteProperties;
|
import net.runelite.client.RuneLiteProperties;
|
||||||
import net.runelite.client.util.VerificationException;
|
import net.runelite.client.util.ImageUtil;
|
||||||
import net.runelite.client.util.LinkBrowser;
|
import net.runelite.client.util.LinkBrowser;
|
||||||
|
import net.runelite.client.util.VerificationException;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class FatalErrorDialog extends JDialog
|
public class FatalErrorDialog extends JDialog
|
||||||
@@ -82,7 +81,7 @@ public class FatalErrorDialog extends JDialog
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
BufferedImage logo = ImageIO.read(SplashScreen.class.getResourceAsStream("runelite_transparent.png"));
|
BufferedImage logo = ImageUtil.getResourceStreamFromClass(FatalErrorDialog.class, "runelite_transparent.png");
|
||||||
setIconImage(logo);
|
setIconImage(logo);
|
||||||
|
|
||||||
JLabel runelite = new JLabel();
|
JLabel runelite = new JLabel();
|
||||||
@@ -92,7 +91,7 @@ public class FatalErrorDialog extends JDialog
|
|||||||
runelite.setOpaque(true);
|
runelite.setOpaque(true);
|
||||||
rightColumn.add(runelite);
|
rightColumn.add(runelite);
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (RuntimeException e)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ import java.awt.image.BufferedImage;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
@@ -46,6 +45,7 @@ import javax.swing.border.EmptyBorder;
|
|||||||
import javax.swing.plaf.basic.BasicProgressBarUI;
|
import javax.swing.plaf.basic.BasicProgressBarUI;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.client.ui.skin.SubstanceRuneLiteLookAndFeel;
|
import net.runelite.client.ui.skin.SubstanceRuneLiteLookAndFeel;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
import org.pushingpixels.substance.internal.SubstanceSynapse;
|
import org.pushingpixels.substance.internal.SubstanceSynapse;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -68,7 +68,7 @@ public class SplashScreen extends JFrame implements ActionListener
|
|||||||
|
|
||||||
private SplashScreen() throws IOException
|
private SplashScreen() throws IOException
|
||||||
{
|
{
|
||||||
BufferedImage logo = ImageIO.read(SplashScreen.class.getResourceAsStream("runelite_transparent.png"));
|
BufferedImage logo = ImageUtil.getResourceStreamFromClass(SplashScreen.class, "runelite_transparent.png");
|
||||||
|
|
||||||
setTitle("RuneLite Launcher");
|
setTitle("RuneLite Launcher");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user