< prev index next >

src/java.desktop/windows/native/libawt/windows/awt_Toolkit.cpp

Print this page

        

@@ -3209,12 +3209,22 @@
  * the IME functionality in an unexpected state.
  * This function avoids reentrancy issue and must be used for sending of all IME messages
  * instead of SendMessage().
  */
 LRESULT AwtToolkit::InvokeInputMethodFunction(UINT msg, WPARAM wParam, LPARAM lParam) {
+    /*
+     * DND runs on the main thread. So it is  necessary to use SendMessage() to call an IME
+     * function once the DND is active; otherwise a hang is possible since DND may wait for
+     * the IME completion.
+     */
+    if (isInDoDragDropLoop) {
+        return SendMessage(msg, wParam, lParam);
+    } else {
     CriticalSection::Lock lock(m_inputMethodLock);
     if (PostMessage(msg, wParam, lParam)) {
         ::WaitForSingleObject(m_inputMethodWaitEvent, INFINITE);
         return m_inputMethodData;
     }
     return 0;
+    }
 }
+
< prev index next >