Community
Participate
Working Groups
Steps to reproduce: * install the starter example * select any element * in the appearance tab, click on the "paint bucket" icon. Like, many many times, for 10s or more * eclipse shuts down, the error log shows: org.eclipse.swt.SWTError: No more handles at org.eclipse.swt.SWT.error(SWT.java:4749) at org.eclipse.swt.SWT.error(SWT.java:4638) at org.eclipse.swt.SWT.error(SWT.java:4609) at org.eclipse.swt.widgets.Display.error(Display.java:1240) at org.eclipse.swt.widgets.Display.internal_new_GC(Display.java:2650) at org.eclipse.swt.graphics.Image.getImageDataAtCurrentZoom(Image.java:1547) at org.eclipse.swt.graphics.Image.getImageData(Image.java:1370) at org.eclipse.swt.internal.ImageList.set(ImageList.java:365) at org.eclipse.swt.internal.ImageList.add(ImageList.java:52) at org.eclipse.swt.widgets.Button._setImage(Button.java:131) at org.eclipse.swt.widgets.Button.setImage(Button.java:891) at org.eclipse.sirius.diagram.ui.tools.internal.dialogs.ColorPalettePopup.<init>(ColorPalettePopup.java:185) at org.eclipse.sirius.diagram.ui.tools.internal.properties.DiagramShapeColorAndFontPropertySection.changeColor(DiagramShapeColorAndFontPropertySection.java:136) at org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ColorsAndFontsPropertySection.changeColor(ColorsAndFontsPropertySection.java:372) at org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ShapeColorsAndFontsPropertySection.changeFillColor(ShapeColorsAndFontsPropertySection.java:85) at org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ShapeColorsAndFontsPropertySection$1.widgetSelected(ShapeColorsAndFontsPropertySection.java:42) Obviously the use case I mention does not happen regularly, but if an user uses the palette regularly for several hours he will encounter it (that's how the bug was found).
I was able to reproduce the issue on ODCE 11.4 and 11.5 with an ecore diagram, we should be able to reproduce it on any element of any diagram.
Note that it may be useful to display the Properties view and the Error Log in parallel beforehand. The error can be opened when restarting Eclipse, since it does not respond at all when reproducing the issue.
There are 2 different issues linked to the ColorPalettePopup: * a leak on Image and/or Button (that can result in "SWTError: No more handles") * a global leak on the ColorPalettePopup and the associated Shell, that are not disposed in some circumstances (exit of the popup without clicking on any button).
New Gerrit change created: https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/180674
New Gerrit change created: https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/180675
There are two ways to validate: FIRST WAY: Steps to validate with debug mode * Open a diagram with at least a node (or a container) * Select a node (or a container) * Open the Properties view and select the tab "Appearance" * Click 10 times on the "paint bucket" button (button to change the background color of the node) * Add a breakpoint on l.141 in method org.eclipse.sirius.diagram.ui.tools.internal.properties.DiagramShapeColorAndFontPropertySection.changeColor(SelectionEvent, Button, String, String, ImageDescriptor), just before opening the ColorPalettePopup ("popup.open(...)"). * Click on the "paint bucket" button * Expected: The code stops on the breakpoint. * In the Debug Shell view, write this code and execute it: System.out.println("======================"); System.out.println("Nb shells = " + button.getParent().getShell().getShells().length); for (org.eclipse.swt.widgets.Shell aShell : button.getParent().getShell().getShells()) { System.out.println("* Is disposed : " + aShell.isDisposed()); } System.out.println("======================"); * The result is displayed in the Console view. * Expected: With the fix, the number of shells should be around 6 (none are disposed). Without the fix, the number of shells is around 16 (none are disposed). * Disable the breakpoint * Resume the code execution * Click again 10 times on the "paint bucket" button * Activate the breakpoint * Click on the "paint bucket" button * Expected: The code stops on the breakpoint. * In the Debug Shell view, execute the code. * Expected: With the fix, the number of shells is the same than the first time. Without the fix, the number of shells is 11 more. SECOND WAY: Steps to validate with Yourkit * Launch Sirius with Yourkit * Open a diagram with at least a node (or a container) * Display the "heap status" (menu Window/Preferences > General/Show heap status) * Select a node (or a container) * Open the Properties view and select the tab "Appearance" * Click 10 times on the "paint bucket" button (button to change the background color of the node) * Run Garbage Collector (by using corresponding button near the heap status) * Capture a Memory Snapshot * In Yourkit, in the Class section, filter on "org.eclipse.sirius.diagram.ui.tools.internal.dialogs.ColorPalettePopup" * Expected: No such object exists. Without the fix, the number of objects is 10. * In Yourkit, in the Class section, filter on "org.eclipse.swt.graphics.RGB" * Expected: A lot of RGB is count. Note the number. * In Yourkit, in the Class section, filter on "org.eclipse.swt.graphics.Image" * Expected: A lot of Image is count. Note the number. * In Yourkit, in the Class section, filter on "org.eclipse.swt.widgets.Button" * Expected: A lot of Button is count. Note the number. * Click 10 times on the "paint bucket" button (button to change the background color of the node) * Run Garbage Collector * Capture a Memory Snapshot * In Yourkit, in the Class section, filter on "org.eclipse.sirius.diagram.ui.tools.internal.dialogs.ColorPalettePopup" * Expected: No such object exists. Without the fix, the number of objects is 20. * In Yourkit, in the Class section, filter on "org.eclipse.swt.graphics.RGB" * Expected: The number of RGB should be the same than previous. Without the fix, the number is also the same (there is no leak on RGB). * In Yourkit, in the Class section, filter on "org.eclipse.swt.graphics.Image" * Expected: The number of Image should be the same than previous. Without the fix, the number is increased by 260 (26 new Image by click) * In Yourkit, in the Class section, filter on "org.eclipse.swt.widgets.Button" * Expected: The number of Button should be the same than previous. Without the fix, the number is increased by 270 (27 new Button by click: 26 for the Color Image button and 1 for the "Custom..." button)
Gerrit change https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/180674 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=c09fead7816e18b0b2b7a91e11e8f0f16b762712
Gerrit change https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/180675 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=ac316b0ace9db1fd6f37aabfe4fb3968c0667252
Validated with Sirius 7.0.0.202201120736. I followed the first scenario.
Available in Sirius 7.0.0, see https://projects.eclipse.org/projects/modeling.sirius/releases/7.0.0