Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8370141

[macOS] Crash after PrinterJob ends when Graphics.create() is used.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • 26
    • 7, 8, 11, 17, 21, 25, 26
    • client-libs
    • None
    • 2d

      There can be a crash on macOS in some cases if an application copies the PrinterGraphics and re-uses it after the job has completed.

      When a Graphics instance is disposed, it reference to the SurfaceData is replaced by NullSurfaceData so all rendering is a no-op.

      However if before that happens, the app uses Graphics.create() it gets a new instance with its own reference to the surfaceData.

      in macOS printing this is a CPrinterSurface which is tied to the graphics context for the native printing operation and this is no longer valid after printing is complete.
      Since there's no way to prevent apps copying Graphics instance and dispose() can't help, the answer must be to invalidate the surface directly so it can't be used any more.

            prr Philip Race
            prr Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: