<AWT Dev>  Review request for 8130136: Swing window sometimes fails to repaint partially when it becomes exposed
alexey.ivanov at oracle.com
Mon Oct 12 09:11:11 UTC 2015
Please review the fix for jdk9:
Sometimes a window fails to repaint when it becomes exposed.
When repaint failure occurs, SetDIBitsToDevice() in
GDIBlitLoops_nativeBlit() returns 0 with error 87 ("Parameter Error").
It happens because invalid, already released, hDC is passed to
When a window is disposed, the DCs associated with it are released. The
handles can be reused for another window.
A thread disposes the window and releases hDC. At this time, DC handle
is reused for another window. When Disposer thread cleans up for a died
thread, it tries to release the cached hDC. But that handle is already
associated with another window. Thus a valid pair hWnd/hDC becomes
invalid: painting to released DC fails.
Save both hDC and hWnd in the thread local storage, and pair hDC with
hWnd when removing it to avoid accidentally releasing hDC which is
already reused for another window.
More information about the awt-dev