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

Phil Race prr at openjdk.org
Thu Oct 30 19:12:11 UTC 2025


On Mon, 20 Oct 2025 20:45:47 GMT, Phil Race <prr at openjdk.org> wrote:

> macOS printing uses a Quartz surface. It is the SurfaceData for a CPrinterGraphics.
> That Surface is not disconnected from the graphics unless Graphics.dispose() is called.
> If the application uses Graphics.create() then the implementation will not Graphics.dispose() it.
> If it is used after printing is complete and the CGContext is no longer valid a crash will occur.
> We need to invalidate the surface as soon as printing to a page is done.
> Note: this is Graphics.dispose(), and is unrelated to disposal of an object when it becomes unreachable.

This pull request has now been integrated.

Changeset: 414e7286
Author:    Phil Race <prr at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/414e72869895562adcea5c21ff3e7252cef5b13f
Stats:     256 lines in 5 files changed: 234 ins; 5 del; 17 mod

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

Reviewed-by: serb, psadhukhan

-------------

PR: https://git.openjdk.org/jdk/pull/27905


More information about the client-libs-dev mailing list