| Summary: | [Cocoa][10.14]NPE for skinned shell-toolbar in dark mode | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Thomas Singer <eclipse> | ||||
| Component: | SWT | Assignee: | Platform-SWT-Inbox <platform-swt-inbox> | ||||
| Status: | VERIFIED FIXED | QA Contact: | |||||
| Severity: | critical | ||||||
| Priority: | P3 | CC: | lshanmug, ned.twigg, register.eclipse, romain.castell, ts-swt | ||||
| Version: | 4.9 | ||||||
| Target Milestone: | 4.13 M1 | ||||||
| Hardware: | Macintosh | ||||||
| OS: | Mac OS X | ||||||
| See Also: |
https://bugs.eclipse.org/bugs/show_bug.cgi?id=543889 https://bugs.eclipse.org/bugs/show_bug.cgi?id=547399 |
||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Note, that the application needs the NSRequireAquaSystemApperance to false. Almost certainly related exception reported when adding:
<key>NSRequiresAquaSystemAppearance</key><false/>
to Info.plist file from Eclipse 2018-12 (4.10.0)
java.lang.NullPointerException
at org.eclipse.swt.widgets.Control.internal_new_GC(Control.java:2180)
at org.eclipse.swt.graphics.GC.<init>(GC.java:177)
at org.eclipse.swt.graphics.GC.<init>(GC.java:138)
at org.eclipse.swt.widgets.Tree.setScrollWidth(Tree.java:3172)
at org.eclipse.swt.widgets.TreeItem.setImage(TreeItem.java:1414)
at org.eclipse.jface.viewers.TreeViewerRow.setImage(TreeViewerRow.java:113)
at org.eclipse.jface.viewers.ViewerCell.setImage(ViewerCell.java:172)
at org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.update(DelegatingStyledCellLabelProvider.java:124)
at org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider.update(DecoratingStyledCellLabelProvider.java:134)
at org.eclipse.jface.viewers.ViewerColumn.refresh(ViewerColumn.java:144)
at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:946)
at org.eclipse.jface.viewers.AbstractTreeViewer$UpdateItemSafeRunnable.run(AbstractTreeViewer.java:120)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.ui.internal.JFaceUtil.lambda$0(JFaceUtil.java:47)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:176)
at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:1025)
at org.eclipse.ui.navigator.CommonViewer.doUpdateItem(CommonViewer.java:404)
at org.eclipse.ui.internal.navigator.resources.ResourceToItemsMapper.updateItem(ResourceToItemsMapper.java:153)
at org.eclipse.ui.internal.navigator.resources.ResourceToItemsMapper.objectChanged(ResourceToItemsMapper.java:141)
at org.eclipse.ui.navigator.CommonViewer.handleLabelProviderChanged(CommonViewer.java:228)
at org.eclipse.jface.viewers.ContentViewer$1.labelProviderChanged(ContentViewer.java:102)
at org.eclipse.jface.viewers.BaseLabelProvider$1.run(BaseLabelProvider.java:75)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.ui.internal.JFaceUtil.lambda$0(JFaceUtil.java:47)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:176)
at org.eclipse.jface.viewers.BaseLabelProvider.fireLabelProviderChanged(BaseLabelProvider.java:72)
at org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider.lambda$0(DecoratingStyledCellLabelProvider.java:78)
at org.eclipse.ui.internal.decorators.DecoratorManager$1.run(DecoratorManager.java:377)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.ui.internal.decorators.DecoratorManager.fireListener(DecoratorManager.java:374)
at org.eclipse.ui.internal.decorators.DecorationScheduler$3.runInUIThread(DecorationScheduler.java:488)
at org.eclipse.ui.progress.UIJob.lambda$0(UIJob.java:98)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4095)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3762)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1173)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1062)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:636)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:563)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:151)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:155)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:595)
at org.eclipse.equinox.launcher.Main.run(Main.java:1501)
The experimental gerrit https://git.eclipse.org/r/#/c/132638/ I created for bug 540357 fixes the NPEs, but setting NSRequireAquaSystemApperance also seems to activate a new cocoa API level, where views are layer backed, which leads to redrawing issues Sooner or later we will have to adapt to this new API behavior anyway, but for now Lakshmi has found a way for programmatically enabling dark mode that doesn't trigger this (see bug 543889) This exception also happens with SWT v4926r16 (ce086f19) and having set org.eclipse.swt.display.useSystemTheme=true (without setting <key>NSRequiresAquaSystemAppearance</key><false/>). (In reply to Thomas Singer from comment #4) > This exception also happens with SWT v4926r16 (ce086f19) and having set > org.eclipse.swt.display.useSystemTheme=true (without setting > <key>NSRequiresAquaSystemAppearance</key><false/>). Can you please check if https://git.eclipse.org/r/#/c/132638/ fixes the NPEs for you? If I've didn't make something wrong, this pull request does NOT fix the toolbar related NPE. Comment #0 is a different issue not related to graphicsContext. My comment #3 was about comment #2 I've create bug 547399 for the issue of NPE in Display.internal_new_GC Created attachment 278694 [details]
Snippet to crash without .app bundle
Are you running with Java 11 or newer? This looks duplicate of Bug 546159. Now, plain ol' Java 8. (In reply to Lakshmi Shanmugam from comment #10) > Are you running with Java 11 or newer? This looks duplicate of Bug 546159. Patch in Bug 546159 fixes the issue in the snippet in this bug as well. This should be fixed now (by fix for Bug 546159) The problem is not related to Bug 540357. |
Running this tiny snippet on macOS 10.14 switched to dark mode public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); final ToolBar toolBar = shell.getToolBar(); toolBar.setData(SWT.SKIN_CLASS, "shell"); shell.setSize(300, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } produces following stacktrace: java.lang.NullPointerException at org.eclipse.swt.widgets.Composite._getChildren(Composite.java:99) at org.eclipse.swt.widgets.Composite.reskinChildren(Composite.java:979) at org.eclipse.swt.widgets.ToolBar.reskinChildren(ToolBar.java:716) at org.eclipse.swt.widgets.Widget.reskin(Widget.java:423) at org.eclipse.swt.widgets.Widget.setData(Widget.java:1704)