Skip to content

Commit

Permalink
Another fix for Win XP crash introduced in 47.3 RC (Issue #180).
Browse files Browse the repository at this point in the history
  • Loading branch information
cztomczak committed Feb 13, 2016
1 parent 7802ead commit 860d0bc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 28 deletions.
22 changes: 10 additions & 12 deletions phpdesktop-chrome47/cef/browser_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ Fullscreen* BrowserWindow::GetFullscreenObject() {
}
void BrowserWindow::SetCefBrowser(CefRefPtr<CefBrowser> cefBrowser) {
// Called from ClientHandler::OnAfterCreated().
_ASSERT(!cefBrowser_.get());
if (cefBrowser_.get()) {
_ASSERT(!cefBrowser_);
if (cefBrowser_) {
LOG_ERROR << "BrowserWindow::SetCefBrowser() called, "
<< "but it is already set";
return;
Expand Down Expand Up @@ -214,23 +214,21 @@ void BrowserWindow::OnGetMinMaxInfo(UINT uMsg, WPARAM wParam, LPARAM lParam) {
}
}
void BrowserWindow::OnSize() {
if (cefBrowser_.get()) {
HWND browserHandle_ = cefBrowser_->GetHost()->GetWindowHandle();
if (!browserHandle_) {
return;
}
if (cefBrowser_) {
HWND browserHandle = cefBrowser_->GetHost()->GetWindowHandle();
_ASSERT(browserHandle);
RECT rect;
GetClientRect(windowHandle_, &rect);
HDWP hdwp = BeginDeferWindowPos(2);
hdwp = DeferWindowPos(hdwp, browserHandle_, NULL,
hdwp = DeferWindowPos(hdwp, browserHandle, NULL,
rect.left, rect.top,
rect.right - rect.left,
rect.bottom - rect.top,
SWP_NOZORDER);
EndDeferWindowPos(hdwp);
} else {
LOG_DEBUG << "BrowserWindow::OnSize() failed: "
"CefBrowser object not created yet";
LOG_DEBUG << "BrowserWindow::OnSize(): "
"CefBrowser object not yet created";
}
}
void BrowserWindow::SetTitleFromSettings() {
Expand Down Expand Up @@ -289,8 +287,8 @@ void BrowserWindow::SetIconFromSettings() {
}
bool BrowserWindow::SetFocus() {
// Calling SetFocus() on shellBrowser handle does not work.
if (cefBrowser_.get()) {
if (cefBrowser_) {
cefBrowser_->GetHost()->SetFocus(true);
}
}
return true;
}
26 changes: 10 additions & 16 deletions phpdesktop-chrome47/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,20 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
switch (uMsg) {
case WM_SIZE:
browser = GetBrowserWindow(hwnd);
if (browser) {
if (browser && browser->GetCefBrowser()) {
browser->OnSize();
} else {
LOG_WARNING << "WindowProc(): event WM_SIZE: "
"could not fetch BrowserWindow";
} else if (!browser) {
LOG_WARNING << "WindowProc() WM_SIZE: could not fetch BrowserWindow";
}
break;
case WM_MOVE:
case WM_MOVING:
case WM_SIZING:
browser = GetBrowserWindow(hwnd);
if (browser) {
if (browser && browser->GetCefBrowser()) {
browser->GetCefBrowser()->GetHost()->NotifyMoveOrResizeStarted();
} else {
LOG_WARNING << "WindowProc(): event WM_MOVING/WM_MOVE/WM_SIZING: "
"could not fetch BrowserWindow";
} else if (!browser) {
LOG_WARNING << "WindowProc() WM_MOVE: could not fetch BrowserWindow";
}
return 0;
case WM_CREATE:
Expand Down Expand Up @@ -160,14 +158,10 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
case WM_ERASEBKGND:
// Erase the background when the browser does not exist.
browser = GetBrowserWindow(hwnd);
if (browser && browser->GetCefBrowser().get()) {
CefWindowHandle hwnd = \
browser->GetCefBrowser()->GetHost()->GetWindowHandle();
if (hwnd) {
// Dont erase the background if the browser window has been loaded
// (this avoids flashing)
return 0;
}
if (browser && browser->GetCefBrowser()) {
// Dont erase the background if the browser window has been loaded
// (this avoids flashing)
return 0;
}
break;
case WM_PAINT:
Expand Down

0 comments on commit 860d0bc

Please sign in to comment.