-
Notifications
You must be signed in to change notification settings - Fork 190
Description
Describe the bug
On Windows, after a DPI/scaling change (e.g., moving an Eclipse/SWT application window between monitors with different scaling, or in VM/RDP-like setups), UI painting can throw an unhandled event loop exception. SWT attempts to rasterize an SVG image for a requested size where the computed width or height becomes 0 (or negative). The SVG rasterizer rejects this and throws IllegalArgumentException, which bubbles up as org.eclipse.swt.SWTException: Invalid image, disrupting painting and sometimes leaving the UI in a broken state.
To Reproduce
- Start an Eclipse-based app that uses SVG icons and renders scaled images during paint (common in editors/views, including those using Draw2D/GEF).
2)Open a view/editor that triggers frequent repaints (e.g., zoomable canvas, thumbnail/overview, outline, etc.).
3)Move the application window between monitors with different DPI scaling (e.g., 100% ↔ 150%/200%), or change scaling while the app is running.
4)Trigger repaint (open/activate editor, zoom, resize window).
5)Observe exception.
Environment:
- App: 4diac IDE 3.1.0.qualifier
- Eclipse Release Train: 2026-03 (Platform 4.39)
- SWT: 4.39 (org.eclipse.swt ~3.133.0… in 4.39 stream)
- Java: 21 (required)
- VM args: -Dswt.autoScale=quarter
- OS: Windows (see stack trace shows Win32 DPI utils)
org.eclipse.swt.SWTException: Invalid image (java.lang.IllegalArgumentException: Argument not valid [Cannot rasterize SVG for width or height <= 0])
at org.eclipse.swt.SWT.error(SWT.java:4950)
at org.eclipse.swt.SWT.error(SWT.java:4865)
at org.eclipse.swt.internal.image.FileFormat.loadFromStreamBySize(FileFormat.java:140)
at org.eclipse.swt.internal.image.FileFormat.load(FileFormat.java:167)
at org.eclipse.swt.internal.NativeImageLoader.load(NativeImageLoader.java:30)
at org.eclipse.swt.graphics.ImageLoader.loadBySize(ImageLoader.java:169)
at org.eclipse.swt.graphics.ImageLoader.loadBySize(ImageLoader.java:215)
at org.eclipse.swt.graphics.ImageDataLoader.loadBySize(ImageDataLoader.java:75)
at org.eclipse.swt.graphics.Image$ImageFileNameProviderWrapper.loadImageDataAtExactSize(Image.java:2737)
at org.eclipse.swt.graphics.Image$HandleAtSize.createHandleAtExactSize(Image.java:239)
at org.eclipse.swt.graphics.Image$HandleAtSize.refresh(Image.java:224)
at org.eclipse.swt.graphics.Image.executeOnImageHandleAtBestFittingSize(Image.java:949)
at org.eclipse.swt.graphics.GC$DrawScaledImageOperation.draw(GC.java:1294)
at org.eclipse.swt.graphics.GC$DrawScaledImageOperation.apply(GC.java:1283)
at org.eclipse.swt.graphics.GC.storeAndApplyOperationForExistingHandle(GC.java:6089)
at org.eclipse.swt.graphics.GC.drawImage(GC.java:1185)
at org.eclipse.swt.graphics.GC.drawImage(GC.java:1052)
at org.eclipse.draw2d.SWTGraphics.drawImage(SWTGraphics.java:444)
at org.eclipse.draw2d.Label.paintFigure(Label.java:498)
at org.eclipse.draw2d.Figure.paint(Figure.java:1274)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1322)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1355)
at org.eclipse.draw2d.Figure.paint(Figure.java:1276)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1322)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1359)
at org.eclipse.draw2d.Figure.paint(Figure.java:1276)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1322)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1355)
at org.eclipse.draw2d.Figure.paint(Figure.java:1276)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1322)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1355)
at org.eclipse.draw2d.Figure.paint(Figure.java:1276)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1322)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1355)
at org.eclipse.draw2d.Figure.paint(Figure.java:1276)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1322)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1355)
at org.eclipse.draw2d.Figure.paint(Figure.java:1276)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1322)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1355)
at org.eclipse.draw2d.Figure.paint(Figure.java:1276)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1322)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1355)
at org.eclipse.draw2d.Figure.paint(Figure.java:1276)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1322)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1355)
at org.eclipse.draw2d.Figure.paint(Figure.java:1276)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1322)
at org.eclipse.draw2d.IScalablePane$IScalablePaneHelper.paintClientArea(IScalablePane.java:109)
at org.eclipse.draw2d.ScalableFreeformLayeredPane.paintClientArea(ScalableFreeformLayeredPane.java:77)
at org.eclipse.draw2d.Figure.paint(Figure.java:1276)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1322)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1355)
at org.eclipse.draw2d.Figure.paint(Figure.java:1276)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1322)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1355)
at org.eclipse.draw2d.Figure.paint(Figure.java:1276)
at org.eclipse.draw2d.parts.Thumbnail$ThumbnailUpdater.run(Thumbnail.java:197)
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:4134)
at org.eclipse.swt.widgets.Display.lambda$3(Display.java:3483)
at org.eclipse.swt.internal.Win32DPIUtils.runWithProperDPIAwareness(Win32DPIUtils.java:94)
at org.eclipse.swt.widgets.Display.msgFilterProc(Display.java:3481)
at org.eclipse.swt.internal.win32.OS.DefWindowProc(Native Method)
at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:509)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:5075)
at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:336)
at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1499)
at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2432)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5129)
at org.eclipse.swt.internal.win32.OS.DefWindowProc(Native Method)
at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:509)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:5075)
at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:336)
at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1499)
at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2432)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5129)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(Native Method)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3745)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1160)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1051)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:684)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:583)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:185)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:219)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:149)
[truncated]