JDK-4994758 : Exception when resizing window results in scrolling.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux_redhat_9.0
  • CPU: x86
  • Submitted: 2004-02-13
  • Updated: 2005-10-13
  • Resolved: 2005-10-13
Related Reports
Duplicate :  
Description
In playing with a Swing app on 1.5 b35 I got the following exception:
sun.java2d.InvalidPipeException: bounds changed
        at sun.awt.X11Renderer.devCopyArea(Native Method)
        at sun.awt.X11SurfaceData.copyArea(X11SurfaceData.java:388)
        at sun.java2d.SunGraphics2D.copyArea(SunGraphics2D.java:1862)
        at javax.swing.JViewport.blitWindowGraphics(JViewport.java:1673)
        at javax.swing.JViewport.blitDoubleBuffered(JViewport.java:1591)
        at javax.swing.JViewport.windowBlitPaint(JViewport.java:1553)
        at javax.swing.JViewport.setViewPosition(JViewport.java:1083)
        at
+javax.swing.plaf.basic.BasicScrollPaneUI.syncScrollPaneWithViewport(BasicScroll+PaneUI.java:322)
        at
+javax.swing.plaf.basic.BasicScrollPaneUI$Handler.viewportStateChanged(BasicScro+llPaneUI.java:855)
        at
+javax.swing.plaf.basic.BasicScrollPaneUI$Handler.stateChanged(BasicScrollPaneUI+.java:797)
        at javax.swing.JViewport.fireStateChanged(JViewport.java:1342)
        at
+javax.swing.JViewport$ViewListener.componentResized(JViewport.java:1260)
        at java.awt.Component.processComponentEvent(Component.java:5291)
        at java.awt.Component.processEvent(Component.java:5245)
        at java.awt.Container.processEvent(Container.java:1961)
        at java.awt.Component.dispatchEventImpl(Component.java:3933)
        at java.awt.Container.dispatchEventImpl(Container.java:2019)
        at java.awt.Component.dispatchEvent(Component.java:3781)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
        at
+java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:+234)
        at
+java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:16+3)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
                                                                                
This happened when the window was being resized and scrolling resulted.
I tried to get a consistant test case but I couldn't.

Comments
EVALUATION This bug appears to be fixed now. The changes for 6173770 addressed the problems with copyArea not catching the IPE exception on invalid surfaces. The test case for bug 6173770 doesn't reproduce on 1.4.2 like the test case for this bug does, so that bug is marked as a regression in 1.5, but the underlying cause is the same for both bugs - the other test case just didn't encounter the problem until 1.5. Marking this as a dup of the other bug.
13-10-2005

EVALUATION These exceptions are thrown when the surface information changes in an incompatible way (such as when the bounds of the drawable change). All of the graphics operations in the Graphics implementation are supposed to catch these errors at some point and redispatch with the updated surface information, but it looks like we missed the copyArea code. Fixing the bug may take a bit of work as the copyArea operation can degenerate into a fairly complicated "series of operations" any one of which may fail. Worse yet, it is dirtying the destination as it goes because the source and destination of the copy operation are the same, so repeating the operation may recopy areas that were already copied. Still, catching the exception and redispatching is better than letting the error fall in the caller's lap. BTW, this test case can reproduce this bug 100% of the time: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class ScrollExceptionBug extends Canvas { public final static int SIZE1W = 640; public final static int SIZE1H = 480; public final static int SIZE2W = 660; public final static int SIZE2H = 500; public static void main(String argv[]) { JFrame f = new JFrame("Scrolling Exception"); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); Canvas seb = new ScrollExceptionBug(); f.getContentPane().add(seb); int w = SIZE1W; int h = SIZE1H; f.setSize(w, h); f.show(); Graphics g = null; for (int i = 0; i < 10; i++) { try { Thread.sleep(100); } catch (InterruptedException e) { break; } if (g == null) { g = seb.getGraphics(); } try { g.copyArea(10, 10, 100, 100, -10, -10); } catch (Exception e) { e.printStackTrace(); f.hide(); f.dispose(); break; } w = SIZE1W + SIZE2W - w; h = SIZE1H + SIZE2H - h; f.setSize(w, h); } } } This is not a new bug, though, since none of the code from release 1.4 onward would catch this exception... ###@###.### 2004-02-17
17-02-2004