Skip to content

Commit

Permalink
We had problems on windows 32bit systems using the reparenting feature.
Browse files Browse the repository at this point in the history
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 chromiumembedded#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.
  • Loading branch information
JScheiterbauer committed Oct 30, 2024
1 parent 8b4225a commit 9eca63f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions native/CefBrowser_N.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 9eca63f

Please sign in to comment.