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

[Windows] Crash if use Graphics after PrintJob.end

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • 26
    • 8, 21, 25
    • client-libs
    • None
    • 2d

      This is very similar to the macOS bug
      https://bugs.openjdk.org/browse/JDK-8370141 but is entirely windows-specific.
      It is also somewhat harder to reproduce, but does if multiple threads are in use.

      When the native Windows GDI call is made, to conclude the job
       EndDoc((HDC)printerDC) call
      it invalidates the HDC (handle to device contest).

      Then depending on timing a call which uses the DC may be made and cause a crash.

      The solution appears to be to synchronize this call to release the dc and all calls which use it on the same lock - the WPrinterJob instance seems like the right place.

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

              Created:
              Updated: