changeset 1340:e279dd2c5a2c

6821291: assertion failure in awt_Frame.h Reviewed-by: dcherepanov, art
author ant
date Tue, 23 Jun 2009 15:53:32 +0400
parents 61e25d428bfe
children 51e452ff726a
files src/windows/native/sun/windows/awt_Frame.cpp src/windows/native/sun/windows/awt_Frame.h
diffstat 2 files changed, 21 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/windows/native/sun/windows/awt_Frame.cpp	Tue Jun 23 15:10:02 2009 +0400
+++ b/src/windows/native/sun/windows/awt_Frame.cpp	Tue Jun 23 15:53:32 2009 +0400
@@ -381,19 +381,28 @@
 
 void AwtFrame::CreateProxyFocusOwner()
 {
+    if (AwtToolkit::IsMainThread()) {
+        AwtFrame::_CreateProxyFocusOwner((void *)this);
+    } else {
+        AwtToolkit::GetInstance().InvokeFunction(AwtFrame::_CreateProxyFocusOwner, (void *)this);
+    }
+}
+
+void AwtFrame::_CreateProxyFocusOwner(void *param)
+{
+    DASSERT(AwtToolkit::IsMainThread());
     DASSERT(m_proxyFocusOwner == NULL);
-    DASSERT(AwtToolkit::MainThread() == ::GetCurrentThreadId());
 
-    m_proxyFocusOwner = ::CreateWindow(TEXT("STATIC"),
-                                       TEXT("ProxyFocusOwner"),
-                                       WS_CHILD,
-                                       0, 0, 0, 0, GetHWnd(), NULL,
-                                       AwtToolkit::GetInstance().
-                                           GetModuleHandle(),
-                                       NULL);
+    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);
 
-    m_proxyDefWindowProc = ComCtl32Util::GetInstance().SubclassHWND(m_proxyFocusOwner, ProxyWindowProc);
-
+    f->m_proxyDefWindowProc = ComCtl32Util::GetInstance().SubclassHWND(f->m_proxyFocusOwner, ProxyWindowProc);
 }
 
 void AwtFrame::DestroyProxyFocusOwner()
--- a/src/windows/native/sun/windows/awt_Frame.h	Tue Jun 23 15:10:02 2009 +0400
+++ b/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);