Ticket #518 (closed defect: fixed)

Opened 8 years ago

Last modified 8 years ago

NullPtrExcep thrown when changing type of image

Reported by: bdezonia Owned by: bdezonia
Priority: major Milestone: biweekly-2011: May-09 to May-20
Component: Display API Version:
Severity: serious Keywords:
Cc: Blocked By:
Blocking:

Description

If you change the type of an image via Image :: Type submenu the image does not draw (the window shrinking as if no buffered image exists) and you get an exception deep in Event handler and paint code and JHotdraw:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

at sun.java2d.SunGraphics2D.getClipBounds(SunGraphics2D.java:1930)
at org.jhotdraw.draw.DefaultDrawing.draw(DefaultDrawing.java:53)
at org.jhotdraw.draw.DefaultDrawingView.drawDrawing(DefaultDrawingView.java:673)
at org.jhotdraw.draw.DefaultDrawingView.drawDrawingVolatileBuffered(DefaultDrawingView.java:463)
at org.jhotdraw.draw.DefaultDrawingView.paintComponent(DefaultDrawingView.java:367)
at javax.swing.JComponent.paint(JComponent.java:1029)
at org.jhotdraw.draw.DefaultDrawingView.paint(DefaultDrawingView.java:739)
at javax.swing.JComponent.paintChildren(JComponent.java:862)
at javax.swing.JComponent.paint(JComponent.java:1038)
at javax.swing.JViewport.paint(JViewport.java:747)
at javax.swing.JComponent.paintChildren(JComponent.java:862)
at javax.swing.JComponent.paint(JComponent.java:1038)
at javax.swing.JComponent.paintChildren(JComponent.java:862)
at javax.swing.JComponent.paint(JComponent.java:1038)
at javax.swing.JComponent.paintChildren(JComponent.java:862)
at javax.swing.JComponent.paint(JComponent.java:1038)
at javax.swing.JComponent.paintChildren(JComponent.java:862)
at javax.swing.JComponent.paint(JComponent.java:1038)
at javax.swing.JComponent.paintChildren(JComponent.java:862)
at javax.swing.JComponent.paint(JComponent.java:1038)
at javax.swing.JLayeredPane.paint(JLayeredPane.java:567)
at javax.swing.JComponent.paintChildren(JComponent.java:862)
at javax.swing.JComponent.paint(JComponent.java:1038)
at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:34)
at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60)
at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97)
at java.awt.Container.paint(Container.java:1793)
at java.awt.Window.paint(Window.java:3375)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:822)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:713)
at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:693)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:125)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:678)
at java.awt.EventQueue.access$000(EventQueue.java:86)
at java.awt.EventQueue$1.run(EventQueue.java:639)
at java.awt.EventQueue$1.run(EventQueue.java:637)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:648)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Change History

comment:1 Changed 8 years ago by bdezonia

  • Owner changed from curtis to bdezonia
  • Status changed from new to assigned
  • Summary changed from NullPtrExcep thrown when chaning type of image to NullPtrExcep thrown when changing type of image

comment:2 Changed 8 years ago by bdezonia

Same thing happens if you rotate an image by 90 degrees (Image :: Transform :: Rotate 90 Right or Left). These plugins change the underlying arrangement of the displayed Dataset and it's associated ImgPlus. Type changes do not change shape of Dataset but do change data of associated ImgPlus.

comment:3 Changed 8 years ago by bdezonia

  • Status changed from assigned to accepted

comment:4 Changed 8 years ago by bdezonia

Similar things happen when you zoom an image (and pan too?).

comment:5 Changed 8 years ago by bdezonia

  • Status changed from accepted to closed
  • Resolution set to fixed

Found that scale initialized to 0 in CanvasHelper. Now defaulting to 1 and have added support for setting an initialScale that you can revert to as needed. Made setZoom(0) revert to this scale. Fixed as of 2e75dbe96eb464569ab2fa462bfec7989c2708c3.

Hatching a new ticket to support the loading and displaying of images that are not at 1:1 scale.

Note: See TracTickets for help on using tickets.