On Fri, 20 Dec 2024 15:01:00 GMT, Kevin Rushforth <k...@openjdk.org> wrote:
> Correction: the listeners no longer get notified after the FX toolkit is > stopped, perhaps due to the fix > for[JDK-8335630](https://bugs.openjdk.org/browse/JDK-8335630). Needs more > investigation. This is not related to JDK-8335630. The notification does get delivered, but ends up going through the "else" block in the following code in `PlatformImpl::updatePreferences`: if (isFxApplicationThread()) { checkHighContrastThemeChanged(preferences); platformPreferences.update(preferences); } else { // Make a defensive copy in case the caller of this method decides to re-use or // modify its preferences map after the method returns. Don't use Map.copyOf // because the preferences map may contain null values. Map<String, Object> preferencesCopy = new HashMap<>(preferences); runLater(() -> updatePreferences(preferencesCopy)); } This happens because `isFxApplicationThread()` returns false after the toolkit is stopped (see `Application::finishTerminating`). The `runLater` at the end of the else block never runs and the runnable is discarded, so the else block ends up being a no-op. So I think my recommendation of "maybe file a P4 bug to look at later" is the most that is needed here. ------------- PR Comment: https://git.openjdk.org/jfx/pull/1656#issuecomment-2557378425