提交 1941e844 编写于 作者: M miroslawzn

6859086: Dialog created by JOptionPane.showMessageDialog does not repaint sometimes

Reviewed-by: bae, chrisphi
上级 ab157aa0
...@@ -54,6 +54,7 @@ static HPEN nullpen; ...@@ -54,6 +54,7 @@ static HPEN nullpen;
static jclass xorCompClass; static jclass xorCompClass;
static jboolean beingShutdown = JNI_FALSE; static jboolean beingShutdown = JNI_FALSE;
static volatile LONG timeStamp = 0;
extern CriticalSection windowMoveLock; extern CriticalSection windowMoveLock;
extern "C" extern "C"
...@@ -90,12 +91,24 @@ void SetupThreadGraphicsInfo(JNIEnv *env, GDIWinSDOps *wsdo) { ...@@ -90,12 +91,24 @@ void SetupThreadGraphicsInfo(JNIEnv *env, GDIWinSDOps *wsdo) {
HDC oldhDC = info->hDC; HDC oldhDC = info->hDC;
// the hDC is NULL for offscreen surfaces - we don't store it // the hDC is NULL for offscreen surfaces - we don't store it
// in TLS as it must be created new every time. // in TLS as it must be created new every time.
if (((oldhDC == NULL) && wsdo->window != NULL) || (info->wsdo != wsdo)) {
if( ((oldhDC == NULL) && wsdo->window != NULL) ||
(info->wsdo != wsdo) ||
(info->wsdoTimeStamp != wsdo->timeStamp) )
{
// Init graphics state, either because this is our first time // Init graphics state, either because this is our first time
// using it in this thread or because this thread is now // using it in this thread or because this thread is now
// dealing with a different window than it was last time. // dealing with a different window than it was last time.
//check extra condition:
//(info->wsdoTimeStamp != wsdo->timeStamp).
//Checking memory addresses (info->wsdo != wsdo) will not detect
//that wsdo points to a newly allocated structure in case
//that structure just got allocated at a "recycled" memory location
//which previously was pointed by info->wsdo
//see bug# 6859086
// Release cached DC. We use deferred DC releasing mechanism because // Release cached DC. We use deferred DC releasing mechanism because
// the DC is associated with cached wsdo and component peer, // the DC is associated with cached wsdo and component peer,
// which may've been disposed by this time, and we have // which may've been disposed by this time, and we have
...@@ -157,7 +170,9 @@ void SetupThreadGraphicsInfo(JNIEnv *env, GDIWinSDOps *wsdo) { ...@@ -157,7 +170,9 @@ void SetupThreadGraphicsInfo(JNIEnv *env, GDIWinSDOps *wsdo) {
info->xorcolor = 0; info->xorcolor = 0;
info->patrop = PATCOPY; info->patrop = PATCOPY;
//store the address and time stamp of newly allocated GDIWinSDOps structure
info->wsdo = wsdo; info->wsdo = wsdo;
info->wsdoTimeStamp = wsdo->timeStamp;
} }
} }
...@@ -367,6 +382,7 @@ Java_sun_java2d_windows_GDIWindowSurfaceData_initOps(JNIEnv *env, jobject wsd, ...@@ -367,6 +382,7 @@ Java_sun_java2d_windows_GDIWindowSurfaceData_initOps(JNIEnv *env, jobject wsd,
JNU_ThrowOutOfMemoryError(env, "Initialization of SurfaceData failed."); JNU_ThrowOutOfMemoryError(env, "Initialization of SurfaceData failed.");
return; return;
} }
wsdo->timeStamp = InterlockedIncrement(&timeStamp); //creation time stamp
wsdo->sdOps.Lock = GDIWinSD_Lock; wsdo->sdOps.Lock = GDIWinSD_Lock;
wsdo->sdOps.GetRasInfo = GDIWinSD_GetRasInfo; wsdo->sdOps.GetRasInfo = GDIWinSD_GetRasInfo;
wsdo->sdOps.Unlock = GDIWinSD_Unlock; wsdo->sdOps.Unlock = GDIWinSD_Unlock;
......
...@@ -148,6 +148,11 @@ typedef void InvalidateSDFunc(JNIEnv *env, ...@@ -148,6 +148,11 @@ typedef void InvalidateSDFunc(JNIEnv *env,
*/ */
struct _GDIWinSDOps { struct _GDIWinSDOps {
SurfaceDataOps sdOps; SurfaceDataOps sdOps;
LONG timeStamp; // creation time stamp.
// Doesn't store a real time -
// just counts creation events of this structure
// made by GDIWindowSurfaceData_initOps()
// see bug# 6859086
jboolean invalid; jboolean invalid;
GetDCFunc *GetDC; GetDCFunc *GetDC;
ReleaseDCFunc *ReleaseDC; ReleaseDCFunc *ReleaseDC;
...@@ -192,6 +197,13 @@ extern "C" { ...@@ -192,6 +197,13 @@ extern "C" {
typedef struct { typedef struct {
HDC hDC; HDC hDC;
GDIWinSDOps *wsdo; GDIWinSDOps *wsdo;
LONG wsdoTimeStamp; // wsdo creation time stamp.
// Other threads may deallocate wsdo
// and then allocate a new GDIWinSDOps
// structure at the same memory location.
// Time stamp is the only way to detect if
// wsdo got changed.
// see bug# 6859086
RECT bounds; RECT bounds;
jobject clip; jobject clip;
jobject comp; jobject comp;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册