Skip to content

Fix Intel crash in ThemeManager on macOS #13543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jul 23, 2025
Merged
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions jabgui/src/main/java/org/jabref/gui/theme/ThemeManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class ThemeManager {
private final WorkspacePreferences workspacePreferences;
private final FileUpdateMonitor fileUpdateMonitor;
private final Consumer<Runnable> updateRunner;
private final ThemeWindowManager themeWindowManager;
private ThemeWindowManager themeWindowManager;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add @Nullable; because we don't use Optionals in class variables; do we @Siedlerchr


private final StyleSheet baseStyleSheet;
private Theme theme;
Expand All @@ -73,7 +73,12 @@ public ThemeManager(WorkspacePreferences workspacePreferences,
this.workspacePreferences = Objects.requireNonNull(workspacePreferences);
this.fileUpdateMonitor = Objects.requireNonNull(fileUpdateMonitor);
this.updateRunner = Objects.requireNonNull(updateRunner);
this.themeWindowManager = ThemeWindowManagerFactory.create();
try {
this.themeWindowManager = ThemeWindowManagerFactory.create();
} catch (UnsatisfiedLinkError | RuntimeException e) {
LOGGER.debug("Failed to create ThemeWindowManager (likely due to native library compatibility issues on intel)", e);
this.themeWindowManager = null;
}

this.baseStyleSheet = StyleSheet.create(Theme.BASE_CSS).get();
this.theme = workspacePreferences.getTheme();
Expand Down Expand Up @@ -121,7 +126,13 @@ private void applyDarkModeToWindow(Stage stage, boolean darkMode) {
return;
}

themeWindowManager.setDarkModeForWindowFrame(stage, darkMode);
if (themeWindowManager != null) {
try {
themeWindowManager.setDarkModeForWindowFrame(stage, darkMode);
} catch (UnsatisfiedLinkError | RuntimeException e) {
LOGGER.debug("Failed to set dark mode for window frame (likely due to native library compatibility issues on intel)", e);
}
}
LOGGER.debug("Applied {} mode to window: {}", darkMode ? "dark" : "light", stage);
}

Expand Down
Loading