New issue
Advanced search Search tips

Issue 707905 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocked on:
issue 665965



Sign in to add a comment

DCHECK in ScreenWin::GetPrimaryScreenWinDisplay() when switching primary display

Project Member Reported by stanisc@chromium.org, Apr 3 2017

Issue description

OS: Windows 10
Chrome version: Private M59 x86 Debug build

Repro steps:
1) Add a secondary monitor on the left of the primary monitor
2) Make sure that the secondary monitor is also on the left of the primary in Windows
3) Make that secondary monitor to be primary  

It looks like the assumption in the code below isn't correct.
Here is the actual value of dispay.bounds():
bounds_	{origin_={x_=-1920 y_=473 } size_={width_=1920 height_=1200 } }	

ScreenWinDisplay ScreenWin::GetPrimaryScreenWinDisplay() const {
  MONITORINFOEX monitor_info = MonitorInfoFromWindow(nullptr,
                                                     MONITOR_DEFAULTTOPRIMARY);
  ScreenWinDisplay screen_win_display = GetScreenWinDisplay(monitor_info);
  Display display = screen_win_display.display();
  // The Windows primary monitor is defined to have an origin of (0, 0).
  DCHECK_EQ(0, display.bounds().origin().x());
  DCHECK_EQ(0, display.bounds().origin().y());
  return screen_win_display;
}

Top of call stack:

>	display.dll!display::win::ScreenWin::GetPrimaryScreenWinDisplay() Line 555	C++
 	display.dll!display::win::ScreenWin::GetPrimaryDisplay() Line 423	C++
 	display.dll!display::win::ScreenWin::GetSystemMetricsForHwnd(HWND__ * hwnd, int metric) Line 320	C++
 	chrome.dll!BrowserDesktopWindowTreeHostWin::GetClientAreaInsets() Line 102	C++
 	views.dll!views::HWNDMessageHandler::GetClientAreaInsets(gfx::Insets * insets) Line 1153	C++
 	views.dll!views::HWNDMessageHandler::OnNCCalcSize(int mode, long l_param) Line 1824	C++
 	views.dll!views::HWNDMessageHandler::_ProcessWindowMessage(HWND__ * hWnd, unsigned int uMsg, unsigned int wParam, long lParam, long & lResult, unsigned long dwMsgMapID) Line 421	C++
 	views.dll!views::HWNDMessageHandler::OnWndProc(unsigned int message, unsigned int w_param, long l_param) Line 915	C++
 	gfx.dll!gfx::WindowImpl::WndProc(HWND__ * hwnd, unsigned int message, unsigned int w_param, long l_param) Line 304	C++
 	gfx.dll!base::win::WrappedWindowProc<&gfx::WindowImpl::WndProc>(HWND__ * hwnd, unsigned int message, unsigned int wparam, long lparam) Line 76	C++
 	user32.dll!__InternalCallWinProc@20()	Unknown
 	user32.dll!UserCallWinProcCheckWow()	Unknown
 	user32.dll!DispatchClientMessage()	Unknown
 	user32.dll!___fnINOUTNCCALCSIZE@4()	Unknown
 	ntdll.dll!_KiUserCallbackDispatcher@12()	Unknown
 	views.dll!views::HWNDMessageHandler::OnDisplayChange(unsigned int bits_per_pixel, const gfx::Size & screen_size) Line 1410	C++
 	views.dll!views::HWNDMessageHandler::_ProcessWindowMessage(HWND__ * hWnd, unsigned int uMsg, unsigned int wParam, long lParam, long & lResult, unsigned long dwMsgMapID) Line 409	C++
 	views.dll!views::HWNDMessageHandler::OnWndProc(unsigned int message, unsigned int w_param, long l_param) Line 915	C++
 	gfx.dll!gfx::WindowImpl::WndProc(HWND__ * hwnd, unsigned int message, unsigned int w_param, long l_param) Line 304	C++
 	gfx.dll!base::win::WrappedWindowProc<&gfx::WindowImpl::WndProc>(HWND__ * hwnd, unsigned int message, unsigned int wparam, long lparam) Line 76	C++

 
That sounds like a pretty fundamental violation of the primary display definition.

https://blogs.msdn.microsoft.com/oldnewthing/20070809-00/?p=25643).

What version of Windows 10 were you using?
Standard corporate image - Windows 10 Enterprise, Version 1511 (OS build 10586.753).

I wonder if this code is called mistakenly for the secondary monitor before it becomes the primary. BTW I get the same assert when I switch back to the original primary monitor.
It's possible. There have been some race conditions where Windows picks up the new primary monitor before we find out about it in Chrome.
Blockedon: 665965

Sign in to add a comment