Skip to content

Commit 3c8c9e7

Browse files
ptzieglerazoitl
authored andcommitted
Avoid potential infinite loop if button is released by ActionListener
The readAndDispatch() method that is implicitly called in the PaletteScrollBar might send a "Mouse Released" event while processing the "Mouse Pressed" event. This then causes the timer to never be cancelled, leading to an infinite scrolling. Closes #733
1 parent bf9d370 commit 3c8c9e7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

org.eclipse.draw2d/src/org/eclipse/draw2d/NativeGraphicsSource.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,13 @@ public Graphics getGraphics(Rectangle r) {
5858

5959
// canvas.update() paints too much and only works on Windows. Use
6060
// readAndDispatch() to only paint the redraw() event.
61-
canvas.getDisplay().readAndDispatch();
61+
62+
// Running readAndDispatch() might fire a mouseReleased() event while processing
63+
// a mousePressed() in e.g. the palette scrollbar. See:
64+
// https://github.com/eclipse-gef/gef-classic/issues/733
65+
if (Animation.isAnimating()) {
66+
canvas.getDisplay().readAndDispatch();
67+
}
6268
return null;
6369
}
6470

0 commit comments

Comments
 (0)