java3d
  1. java3d
  2. JAVA3D-583

A disposed Graphics2D remains in Canvas3D after removal and addtion

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.1
    • Fix Version/s: 1.5.2
    • Component/s: j3d-core
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      583

      Description

      When a Canvas3D is removed and then added back to a container, the Graphics2D
      object returned by getGraphics2D() is disposed. This is caused by a bug in
      Canvas3D's freeContextResources method. In that method the Graphics2D referred
      by graphics2D field, but the field value is not nullified. When getGraphics2D()
      method is called after that, the Graphics2D returned is not usable and the
      following exception is thrown:

      Exception occurred during Canvas3D callback:
      java.lang.IllegalStateException: Cannot use Graphics2D object after dispose() is
      called
      at javax.media.j3d.J3DGraphics2DImpl.flush(J3DGraphics2DImpl.java:141)
      at com.solibri.sae.cad.java3d.Immcanvas.postRender(Immcanvas.java:166)
      at javax.media.j3d.Renderer.doWork(Renderer.java:1426)
      at javax.media.j3d.J3dThread.run(J3dThread.java:275)

      1. issue583.diff
        0.8 kB
        paasiala
      2. patch-582.diff
        0.7 kB
        paasiala

        Activity

        Hide
        paasiala added a comment -
        Show
        paasiala added a comment - I added a patch that seems to work. https://java3d.dev.java.net/nonav/issues/showattachment.cgi/356/patch-582.diff
        Hide
        kcr added a comment -

        Good catch of the NPE. The root cause of this is a missing check for
        hasBeenDisposed in the dispose() method, so I'll add that in addition to the
        null check that you suggested. I will commit the fix today, and it will be in
        tomorrow's daily build.

        Show
        kcr added a comment - Good catch of the NPE. The root cause of this is a missing check for hasBeenDisposed in the dispose() method, so I'll add that in addition to the null check that you suggested. I will commit the fix today, and it will be in tomorrow's daily build.
        Hide
        kcr added a comment -

        Mark as fixed in 1.5.2-beta2

        Show
        kcr added a comment - Mark as fixed in 1.5.2-beta2
        Hide
        paasiala added a comment -

        Thanks.

        We tested this on Windows XP 32 and Vista 64 platforms without problems.

        I mark the bug verified.

        Show
        paasiala added a comment - Thanks. We tested this on Windows XP 32 and Vista 64 platforms without problems. I mark the bug verified.
        Hide
        kcr added a comment -
            • Issue 510 has been marked as a duplicate of this issue. ***
        Show
        kcr added a comment - Issue 510 has been marked as a duplicate of this issue. ***

          People

          • Assignee:
            kcr
            Reporter:
            paasiala
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: