提交 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;
static jclass xorCompClass;
static jboolean beingShutdown = JNI_FALSE;
static volatile LONG timeStamp = 0;
extern CriticalSection windowMoveLock;
extern "C"
......@@ -90,12 +91,24 @@ void SetupThreadGraphicsInfo(JNIEnv *env, GDIWinSDOps *wsdo) {
HDC oldhDC = info->hDC;
// the hDC is NULL for offscreen surfaces - we don't store it
// 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
// using it in this thread or because this thread is now
// 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
// the DC is associated with cached wsdo and component peer,
// which may've been disposed by this time, and we have
......@@ -157,7 +170,9 @@ void SetupThreadGraphicsInfo(JNIEnv *env, GDIWinSDOps *wsdo) {
info->xorcolor = 0;
info->patrop = PATCOPY;
//store the address and time stamp of newly allocated GDIWinSDOps structure
info->wsdo = wsdo;
info->wsdoTimeStamp = wsdo->timeStamp;
}
}
......@@ -367,6 +382,7 @@ Java_sun_java2d_windows_GDIWindowSurfaceData_initOps(JNIEnv *env, jobject wsd,
JNU_ThrowOutOfMemoryError(env, "Initialization of SurfaceData failed.");
return;
}
wsdo->timeStamp = InterlockedIncrement(&timeStamp); //creation time stamp
wsdo->sdOps.Lock = GDIWinSD_Lock;
wsdo->sdOps.GetRasInfo = GDIWinSD_GetRasInfo;
wsdo->sdOps.Unlock = GDIWinSD_Unlock;
......
......@@ -148,6 +148,11 @@ typedef void InvalidateSDFunc(JNIEnv *env,
*/
struct _GDIWinSDOps {
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;
GetDCFunc *GetDC;
ReleaseDCFunc *ReleaseDC;
......@@ -192,6 +197,13 @@ extern "C" {
typedef struct {
HDC hDC;
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;
jobject clip;
jobject comp;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册