On Fri Oct 17 08:35:05 2025 +0000, Zhao Yi wrote:
Just wrote a test program as follows: Test1:
HDC hdc = GetDC(hWndA); BOOL ret = UpdateLayeredWindow(hWndA, NULL, NULL, &si, hdc, &pi, 0, &bf, ULW_ALPHA); ReleaseDC(hWndA, hdc);Test2:
HDC hdc = CreateCompatibleDC(NULL); BOOL ret = UpdateLayeredWindow(hWndA, NULL, NULL, &si, hdc, &pi, 0, &bf, ULW_ALPHA); ReleaseDC(NULL, hdc);The test results confirm what you said: The window DC created in Test1 doesn't unnecessary to lock the surface, and calling window_surface_lock would cause a deadlock.
The compatible DC created in Test2 requires locking.
After applying the changes according to the patch file, the call to the UpdateLayeredWindow function failed. I will continue to analyze the cause. [fix-deadlock.patch](/uploads/51708682a6c0d42328d07e5a05bb6468/fix-deadlock.patch)