bndtools / bnd

Bnd/Bndtools. Tooling to build OSGi bundles including Eclipse, Maven, and Gradle plugins.
https://bndtools.org
Other
532 stars 305 forks source link

Argument not valid in Outline view of bnd editor. #6322

Closed chrisrueger closed 1 month ago

chrisrueger commented 1 month ago

I am not a 100% how I managed to get this exception, but currently I get it a lot. I am doing lots of stuff with tweaking optional Import-Packages. Looks like the icons / images in the outline are somehow related to the Import-Packages.

I will dig into but maybe try to just catch the error.

image
java.lang.IllegalArgumentException: Argument not valid
    at org.eclipse.swt.SWT.error(SWT.java:4903)
    at org.eclipse.swt.SWT.error(SWT.java:4837)
    at org.eclipse.swt.SWT.error(SWT.java:4808)
    at org.eclipse.swt.widgets.Widget.error(Widget.java:853)
    at org.eclipse.swt.widgets.TreeItem.setImage(TreeItem.java:1357)
    at org.eclipse.jface.viewers.TreeViewerRow.setImage(TreeViewerRow.java:110)
    at org.eclipse.jface.viewers.ViewerCell.setImage(ViewerCell.java:171)
    at bndtools.editor.BndEditorContentOutlineLabelProvider.update(BndEditorContentOutlineLabelProvider.java:45)
    at org.eclipse.jface.viewers.ViewerColumn.refresh(ViewerColumn.java:149)
    at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:1000)
    at org.eclipse.jface.viewers.AbstractTreeViewer$UpdateItemSafeRunnable.run(AbstractTreeViewer.java:158)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:174)
    at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:1073)
    at org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.run(StructuredViewer.java:426)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:174)
    at org.eclipse.jface.viewers.StructuredViewer.updateItem(StructuredViewer.java:2111)
    at org.eclipse.jface.viewers.AbstractTreeViewer.updateChildren(AbstractTreeViewer.java:3007)
    at org.eclipse.jface.viewers.AbstractTreeViewer.internalRefreshStruct(AbstractTreeViewer.java:2031)
    at org.eclipse.jface.viewers.TreeViewer.internalRefreshStruct(TreeViewer.java:684)
    at org.eclipse.jface.viewers.AbstractTreeViewer.internalRefresh(AbstractTreeViewer.java:2004)
    at org.eclipse.jface.viewers.AbstractTreeViewer.internalRefresh(AbstractTreeViewer.java:1961)
    at org.eclipse.jface.viewers.AbstractTreeViewer.internalRefresh(AbstractTreeViewer.java:1947)
    at org.eclipse.jface.viewers.StructuredViewer.lambda$2(StructuredViewer.java:1463)
    at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1392)
    at org.eclipse.jface.viewers.TreeViewer.preservingSelection(TreeViewer.java:367)
    at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1353)
    at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1463)
    at org.eclipse.jface.viewers.ColumnViewer.refresh(ColumnViewer.java:521)
    at bndtools.editor.BndEditorContentOutlineProvider.propertyChange(BndEditorContentOutlineProvider.java:147)
    at java.desktop/java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:343)
    at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:335)
    at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:268)
    at aQute.bnd.build.model.BndEditModel.loadFrom(BndEditModel.java:449)
    at aQute.bnd.build.model.BndEditModel.loadFrom(BndEditModel.java:408)
    at bndtools.editor.BndEditor.lambda$loadEditModel$2(BndEditor.java:635)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:132)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4382)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4005)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1151)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1042)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
    at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:639)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:546)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:208)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:143)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:109)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:439)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:271)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:668)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:605)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1481)
pkriens commented 1 month ago

Weird. Looks like an invalid image.

chrisrueger commented 1 month ago

Strange, now I cannot reproduce it.

The code seems to be this. Image disposed? What could cause this?

org.eclipse.swt.widgets.TreeItem.setImage(int, Image)

image

Here I only have my laptop. In the office where I had the error I have a large monitor. I found this https://bugs.eclipse.org/bugs/show_bug.cgi?id=575707 "IllegalArgumentException when resolving overlay image on HighRes screen" which sounds like it could be resolution dependend. I will try to reproduce it and hopefully be able to debug.

kriegfrj commented 1 month ago

Strange, now I cannot reproduce it.

The code seems to be this. Image disposed? What could cause this?

Does this happen when you are working on the Eclipse/Bndtools dev instance, launched from the bnd workspace? Or does it happen when you're working on a standalone Eclipse instance?

It's been a while, but I remember that @pkriens put some centralised image resource management into one of our bundles. If that bundle is restarted (which can happen eg if you change some of the code and you've got automatic building turned on), it can cause the image handle to be disposed, and because lots of the Eclipse UI implementation does not handle dynamics well it can still hang on to the stale handles.

chrisrueger commented 1 month ago

Does this happen when you are working on the Eclipse/Bndtools dev instance, launched from the bnd workspace? Or does it happen when you're working on a standalone Eclipse instance?

No, that happens when I am working with a normal Eclipse (2024-09) with a recent bndtools 7.1.0 SNAPSHOT installed. It basically happened during normal daily work (not bndtools development). I will keep an eye on it.

pkriens commented 1 month ago

It tends to happen when bundles get updated. In Icons i tried to handle this but not all code uses Icons.

chrisrueger commented 1 month ago

I will close it for now and reopen when it happens again.