From 1ffdabe0d88111e870ff8833844d9efb24b2f3b7 Mon Sep 17 00:00:00 2001 From: "garykac@chromium.org" Date: Tue, 23 Oct 2012 17:41:15 +0000 Subject: [PATCH] [Chromoting] Fix crash on initial connection (Mac). If we get a ScreenRefresh while desktop_bounds_ is empty, we'll try to capture the screen into an empty buffer. The fix is to check the desktop_bounds_ and update the screen configuration before initiating the ScreenRefresh. BUG=154716 Review URL: https://chromiumcodereview.appspot.com/11231056 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163588 0039d316-1c4b-4281-b951-d872f2087c98 --- remoting/host/video_frame_capturer_mac.mm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/remoting/host/video_frame_capturer_mac.mm b/remoting/host/video_frame_capturer_mac.mm index 0d449961330e..edf1a874467c 100644 --- a/remoting/host/video_frame_capturer_mac.mm +++ b/remoting/host/video_frame_capturer_mac.mm @@ -747,6 +747,7 @@ void VideoFrameCapturerMac::ScreenConfigurationChanged() { void VideoFrameCapturerMac::ScreenRefresh(CGRectCount count, const CGRect* rect_array) { + DCHECK(!desktop_bounds_.isEmpty()); SkIRect skirect_array[count]; for (CGRectCount i = 0; i < count; ++i) { skirect_array[i] = CGRectToSkIRect(rect_array[i]); @@ -796,6 +797,9 @@ void VideoFrameCapturerMac::ScreenRefreshCallback(CGRectCount count, void* user_parameter) { VideoFrameCapturerMac* capturer = reinterpret_cast( user_parameter); + if (capturer->desktop_bounds_.isEmpty()) { + capturer->ScreenConfigurationChanged(); + } capturer->ScreenRefresh(count, rect_array); } -- 2.11.4.GIT