From dcb94bba42c86735c5dd7ddaf2a1d276dabd4f55 Mon Sep 17 00:00:00 2001 From: Jannis Weis <31143295+weisJ@users.noreply.github.com> Date: Sun, 6 Feb 2022 16:00:10 +0100 Subject: [PATCH] Update comment about having to disable reporting before program exit --- .../java/com/github/weisj/darklaf/LafManager.java | 6 +++--- .../preferences/SystemPreferencesManager.java | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/github/weisj/darklaf/LafManager.java b/core/src/main/java/com/github/weisj/darklaf/LafManager.java index 6f1917709..9515453ca 100644 --- a/core/src/main/java/com/github/weisj/darklaf/LafManager.java +++ b/core/src/main/java/com/github/weisj/darklaf/LafManager.java @@ -124,9 +124,9 @@ public static void setDecorationsEnabled(final boolean enabled) { * {@link ThemePreferenceListener}s. On some platforms this setting may do nothing. * *

- * Warning: If preference reporting is enabled it needs to be disabled before closing the - * program. Not doing so can result in memory leaks and prevent the classloader from being garbage - * collected. + * Warning: If preference reporting is enabled it needs to be disabled for the classloader to + * be eligible for garbage collection. This is only relevant if you actually need the classloader to + * be unloaded. * * @param enabled true if changes should be reported. */ diff --git a/platform-preferences/src/main/java/com/github/weisj/darklaf/platform/preferences/SystemPreferencesManager.java b/platform-preferences/src/main/java/com/github/weisj/darklaf/platform/preferences/SystemPreferencesManager.java index da9f42812..b8a231e76 100644 --- a/platform-preferences/src/main/java/com/github/weisj/darklaf/platform/preferences/SystemPreferencesManager.java +++ b/platform-preferences/src/main/java/com/github/weisj/darklaf/platform/preferences/SystemPreferencesManager.java @@ -83,6 +83,17 @@ private static ThemePreferenceProvider createProvider(final boolean allowNativeR return nativeProvider; } + /** + * Enabled whether changes in the preferred theme style should be reported to + * {@link SystemPreferenceChangeListener}s. On some platforms this setting may do nothing. + * + *

+ * Warning: If preference reporting is enabled it needs to be disabled for the classloader to + * be eligible for garbage collection. This is only relevant if you actually need the classloader to + * be unloaded. + * + * @param reportingEnabled true if changes should be reported. + */ public void enableReporting(final boolean reportingEnabled) { if (isReportingEnabled() != reportingEnabled) { preferenceProvider.setReporting(reportingEnabled);