6821291: assertion failure in awt_Frame.h
authorant
Tue, 23 Jun 2009 15:53:32 +0400
changeset 3086 1088cc6368b7
parent 3085 0c2f4bcb2728
child 3087 e5f156d403ad
6821291: assertion failure in awt_Frame.h Reviewed-by: dcherepanov, art
jdk/src/windows/native/sun/windows/awt_Frame.cpp
jdk/src/windows/native/sun/windows/awt_Frame.h
--- a/jdk/src/windows/native/sun/windows/awt_Frame.cpp	Tue Jun 23 15:10:02 2009 +0400
+++ b/jdk/src/windows/native/sun/windows/awt_Frame.cpp	Tue Jun 23 15:53:32 2009 +0400
@@ -381,19 +381,28 @@
 
 void AwtFrame::CreateProxyFocusOwner()
 {
-    DASSERT(m_proxyFocusOwner == NULL);
-    DASSERT(AwtToolkit::MainThread() == ::GetCurrentThreadId());
+    if (AwtToolkit::IsMainThread()) {
+        AwtFrame::_CreateProxyFocusOwner((void *)this);
+    } else {
+        AwtToolkit::GetInstance().InvokeFunction(AwtFrame::_CreateProxyFocusOwner, (void *)this);
+    }
+}
 
-    m_proxyFocusOwner = ::CreateWindow(TEXT("STATIC"),
-                                       TEXT("ProxyFocusOwner"),
-                                       WS_CHILD,
-                                       0, 0, 0, 0, GetHWnd(), NULL,
-                                       AwtToolkit::GetInstance().
-                                           GetModuleHandle(),
-                                       NULL);
+void AwtFrame::_CreateProxyFocusOwner(void *param)
+{
+    DASSERT(AwtToolkit::IsMainThread());
+    DASSERT(m_proxyFocusOwner == NULL);
 
-    m_proxyDefWindowProc = ComCtl32Util::GetInstance().SubclassHWND(m_proxyFocusOwner, ProxyWindowProc);
+    AwtFrame *f = (AwtFrame *)param;
+    f->m_proxyFocusOwner = ::CreateWindow(TEXT("STATIC"),
+                                          TEXT("ProxyFocusOwner"),
+                                          WS_CHILD,
+                                          0, 0, 0, 0, f->GetHWnd(), NULL,
+                                          AwtToolkit::GetInstance().
+                                          GetModuleHandle(),
+                                          NULL);
 
+    f->m_proxyDefWindowProc = ComCtl32Util::GetInstance().SubclassHWND(f->m_proxyFocusOwner, ProxyWindowProc);
 }
 
 void AwtFrame::DestroyProxyFocusOwner()
--- a/jdk/src/windows/native/sun/windows/awt_Frame.h	Tue Jun 23 15:10:02 2009 +0400
+++ b/jdk/src/windows/native/sun/windows/awt_Frame.h	Tue Jun 23 15:53:32 2009 +0400
@@ -117,7 +117,6 @@
     INLINE BOOL IsUndecorated() { return m_isUndecorated; }
 
     INLINE HWND GetProxyFocusOwner() {
-        DASSERT(AwtToolkit::MainThread() == ::GetCurrentThreadId());
         if (m_proxyFocusOwner == NULL) {
             CreateProxyFocusOwner();
         }
@@ -165,6 +164,8 @@
     void CreateProxyFocusOwner();
     void DestroyProxyFocusOwner();
 
+    /* creates proxy focus owner, called on Toolkit thread */
+    static void _CreateProxyFocusOwner(void *param);
     /* destroys proxy focus owner, called on Toolkit thread */
     static void _DestroyProxyFocusOwner(void *param);