-
-
Notifications
You must be signed in to change notification settings - Fork 268
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
NullPointerException in tabbed pane #299
Comments
Hmm, one of the two Field
FlatLaf/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTabbedPaneUI.java Lines 1394 to 1396 in d13ddeb
To prevent your exception, I should check there also But still trying to imagine how this could happen... At the moment, I have only one idea: when changing public void propertyChange(PropertyChangeEvent e) {
...
} else if (name == "tabLayoutPolicy") {
BasicTabbedPaneUI.this.uninstallUI(pane);
BasicTabbedPaneUI.this.installUI(pane);
... So if above code is executed on another thread, and Are you using multiple threads? |
Yes! Now that you say it, this is actually a possibility. At startup, we instantiate various UI components in a background thread, and these components are never added to any frame (they are not made visible nor connected to native peers). The purpose of instantiating them is that it loads thousands of classes in the classloaders and some shared caches. When a user navigates to such component, it opens very fast (no cost of loading resources): it greatly improves user experience. This code has been there for 10+ years and it is the first time I see an exception. We know that "Swing is not thread safe" and that "UI interactions should be done in the UI thread", but in this case the UI components are not displayable and there is no user interaction. I wonder if uninstallUI/installUI is a proper way of setting things up in case of property change. Also, posting actions to make the selected tab visible when the component is not displayable may not seem very necessary; this code is likely to be triggered anyway if the component were be made visible. Any thoughts? 😉 |
Yes, it is a issue in FlatLaf.
Well, it is in
Yes, more checks are needed in Still wonder what triggers invocation of Do you use leading or trailing components in tab area? (client properties Have added more checks in commit d31f167 that should fix the NPE. |
I do use |
Should be fixed with FlatLaf 1.1.2. |
I got an exception which I am not able to reproduce. Still, there was nothing special I did so I report it in case it helps uncovering a bug in FlatLaf.
As I can remember, during initialization of various stuff at application startup, I grabbed the titled bar of the maximized frame and moved it which triggered all sorts of resizing. The exception was thrown.
Hopefully the stack trace gives some information or at least allows to add some test / catch code to prevent such exception from happening.
I am using OpenJDK 13.0.2+8.
The text was updated successfully, but these errors were encountered: