diff --git a/gradle.properties b/gradle.properties index 11ef0056..5262d418 100644 --- a/gradle.properties +++ b/gradle.properties @@ -29,7 +29,7 @@ net.ltgt.errorprone.version = 2.0.2 # Dependencies # Libraries -jsvg.version = 0.0.2 +jsvg.version = 0.0.3 swingDsl.version = 0.1.3 swingx.version = 1.6.1 nullabilityAnnotations.version = 23.0.0 diff --git a/property-loader/src/main/java/com/github/weisj/darklaf/properties/icons/IconLoader.java b/property-loader/src/main/java/com/github/weisj/darklaf/properties/icons/IconLoader.java index d864f15d..ea5206c7 100644 --- a/property-loader/src/main/java/com/github/weisj/darklaf/properties/icons/IconLoader.java +++ b/property-loader/src/main/java/com/github/weisj/darklaf/properties/icons/IconLoader.java @@ -77,8 +77,11 @@ public final class IconLoader implements IconResolver { loader = new SVGLoader(); } - static SVGLoader svgLoader() { - return loader; + static @NotNull SVGLoader svgLoader() { + // SVGLoader is not thread safe. For the EDT we use a cached version to avoid UI slow downs. + // All other cases are probably fine with the overhead of creating a new SVGLoader instance. + if (SwingUtilities.isEventDispatchThread()) return loader; + return new SVGLoader(); } /**