mirror of
https://github.com/openjdk/jdk18u.git
synced 2025-12-11 20:46:16 -06:00
8274751: Drag And Drop hangs on Windows
Backport-of: 7a0a6c95a53c6cb3340328d6543a97807320b740
This commit is contained in:
parent
76a2b3bfaf
commit
bb5bc6a87e
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -267,13 +267,13 @@ void AwtDragSource::_DoDragDrop(void* param) {
|
||||
dragSource->Signal();
|
||||
|
||||
AwtToolkit &toolkit = AwtToolkit::GetInstance();
|
||||
toolkit.isInDoDragDropLoop = TRUE;
|
||||
toolkit.isDnDSourceActive = TRUE;
|
||||
res = ::DoDragDrop(dragSource,
|
||||
dragSource,
|
||||
convertActionsToDROPEFFECT(dragSource->m_actions),
|
||||
&effects
|
||||
);
|
||||
toolkit.isInDoDragDropLoop = FALSE;
|
||||
toolkit.isDnDSourceActive = FALSE;
|
||||
|
||||
if (effects == DROPEFFECT_NONE && dragSource->m_dwPerformedDropEffect != DROPEFFECT_NONE) {
|
||||
effects = dragSource->m_dwPerformedDropEffect;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -141,7 +141,7 @@ static void ScaleDown(POINT &cp, HWND m_window) {
|
||||
|
||||
HRESULT __stdcall AwtDropTarget::DragEnter(IDataObject __RPC_FAR *pDataObj, DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect) {
|
||||
TRY;
|
||||
AwtToolkit::GetInstance().isInDoDragDropLoop = TRUE;
|
||||
AwtToolkit::GetInstance().isDnDTargetActive = TRUE;
|
||||
if (NULL != m_pIDropTargetHelper) {
|
||||
m_pIDropTargetHelper->DragEnter(
|
||||
m_window,
|
||||
@ -161,7 +161,7 @@ HRESULT __stdcall AwtDropTarget::DragEnter(IDataObject __RPC_FAR *pDataObj, DWOR
|
||||
(IsLocalDnD() && !IsLocalDataObject(pDataObj)))
|
||||
{
|
||||
*pdwEffect = retEffect;
|
||||
AwtToolkit::GetInstance().isInDoDragDropLoop = FALSE;
|
||||
AwtToolkit::GetInstance().isDnDTargetActive = FALSE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ HRESULT __stdcall AwtDropTarget::DragEnter(IDataObject __RPC_FAR *pDataObj, DWOR
|
||||
}
|
||||
|
||||
if (JNU_IsNull(env, m_dtcp) || !JNU_IsNull(env, safe_ExceptionOccurred(env))) {
|
||||
AwtToolkit::GetInstance().isInDoDragDropLoop = FALSE;
|
||||
AwtToolkit::GetInstance().isDnDTargetActive = FALSE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -200,12 +200,12 @@ HRESULT __stdcall AwtDropTarget::DragEnter(IDataObject __RPC_FAR *pDataObj, DWOR
|
||||
env->ExceptionDescribe();
|
||||
env->ExceptionClear();
|
||||
actions = java_awt_dnd_DnDConstants_ACTION_NONE;
|
||||
AwtToolkit::GetInstance().isInDoDragDropLoop = FALSE;
|
||||
AwtToolkit::GetInstance().isDnDTargetActive = FALSE;
|
||||
}
|
||||
} catch (std::bad_alloc&) {
|
||||
retEffect = ::convertActionsToDROPEFFECT(actions);
|
||||
*pdwEffect = retEffect;
|
||||
AwtToolkit::GetInstance().isInDoDragDropLoop = FALSE;
|
||||
AwtToolkit::GetInstance().isDnDTargetActive = FALSE;
|
||||
throw;
|
||||
}
|
||||
|
||||
@ -421,7 +421,7 @@ void AwtDropTarget::DropDone(jboolean success, jint action) {
|
||||
m_dropSuccess = success;
|
||||
m_dropActions = action;
|
||||
AwtToolkit::GetInstance().QuitMessageLoop(AwtToolkit::EXIT_ENCLOSING_LOOP);
|
||||
AwtToolkit::GetInstance().isInDoDragDropLoop = FALSE;
|
||||
AwtToolkit::GetInstance().isDnDTargetActive = FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1136,7 +1136,7 @@ void AwtDropTarget::UnloadCache() {
|
||||
|
||||
void AwtDropTarget::DragCleanup(void) {
|
||||
UnloadCache();
|
||||
AwtToolkit::GetInstance().isInDoDragDropLoop = FALSE;
|
||||
AwtToolkit::GetInstance().isDnDTargetActive = FALSE;
|
||||
}
|
||||
|
||||
BOOL AwtDropTarget::IsLocalDataObject(IDataObject __RPC_FAR *pDataObject) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -344,7 +344,8 @@ AwtToolkit::AwtToolkit() {
|
||||
|
||||
m_waitEvent = ::CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
m_inputMethodWaitEvent = ::CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
isInDoDragDropLoop = FALSE;
|
||||
isDnDSourceActive = FALSE;
|
||||
isDnDTargetActive = FALSE;
|
||||
eventNumber = 0;
|
||||
}
|
||||
|
||||
@ -3012,7 +3013,7 @@ Java_sun_awt_windows_WToolkit_syncNativeQueue(JNIEnv *env, jobject self, jlong t
|
||||
tk.PostMessage(WM_SYNC_WAIT, 0, 0);
|
||||
for(long t = 2; t < timeout &&
|
||||
WAIT_TIMEOUT == ::WaitForSingleObject(tk.m_waitEvent, 2); t+=2) {
|
||||
if (tk.isInDoDragDropLoop) {
|
||||
if (tk.isDnDSourceActive || tk.isDnDTargetActive) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -3216,7 +3217,7 @@ LRESULT AwtToolkit::InvokeInputMethodFunction(UINT msg, WPARAM wParam, LPARAM lP
|
||||
* the IME completion.
|
||||
*/
|
||||
CriticalSection::Lock lock(m_inputMethodLock);
|
||||
if (isInDoDragDropLoop) {
|
||||
if (isDnDSourceActive || isDnDTargetActive) {
|
||||
SendMessage(msg, wParam, lParam);
|
||||
::ResetEvent(m_inputMethodWaitEvent);
|
||||
return m_inputMethodData;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -441,7 +441,8 @@ public:
|
||||
|
||||
HANDLE m_waitEvent;
|
||||
volatile DWORD eventNumber;
|
||||
volatile BOOL isInDoDragDropLoop;
|
||||
volatile BOOL isDnDSourceActive;
|
||||
volatile BOOL isDnDTargetActive;
|
||||
private:
|
||||
HWND CreateToolkitWnd(LPCTSTR name);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user