From 9eca63f9309cb5cc2e4d94b1e0ceff213a31db1a Mon Sep 17 00:00:00 2001 From: JScheiterbauer Date: Wed, 30 Oct 2024 08:04:45 +0100 Subject: [PATCH] We had problems on windows 32bit systems using the reparenting feature. Sometimes (timing issue) the JCEF native code in CefBrowser_N.cpp uses a wrong parent window handle. With this change the problem was gone, also see #321. Reproduction: The problem can happen on physical machines too but happen much more often when connected to remote machines (e.g. Citrix sessions, Remote Desktop, VMWares,...). - Start detailed MainFrame - Menu -> Tests -> Reparent - Press the "Reparent " Button as fast as you can (Space bar helps) The bug then sometimes happens on the 5th try or you have to do this for a minute or so. --- native/CefBrowser_N.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/native/CefBrowser_N.cpp b/native/CefBrowser_N.cpp index 98b7fb45..54226043 100644 --- a/native/CefBrowser_N.cpp +++ b/native/CefBrowser_N.cpp @@ -2122,8 +2122,10 @@ Java_org_cef_browser_CefBrowser_1N_N_1SetParent(JNIEnv* env, std::move(callback)); #else CefWindowHandle browserHandle = browser->GetHost()->GetWindowHandle(); - CefWindowHandle parentHandle = - canvas ? util::GetWindowHandle(env, canvas) : kNullWindowHandle; + if (canvas != NULL) + parentHandle = util::GetWindowHandle(env, canvas); + else + parentHandle = TempWindow::GetWindowHandle(); if (CefCurrentlyOn(TID_UI)) { util::SetParent(browserHandle, parentHandle, std::move(callback)); } else {