diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-07 08:01:48 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-07 08:01:48 +0000 |
commit | 97d82ed17e163035e9dd9c493e5695512523a37b (patch) | |
tree | ea775d0f45befdf074c28148d1907513e354f4cd | |
parent | 3df60a57e32024e0ba31bbf8e821534a44296253 (diff) | |
download | chromium_src-97d82ed17e163035e9dd9c493e5695512523a37b.zip chromium_src-97d82ed17e163035e9dd9c493e5695512523a37b.tar.gz chromium_src-97d82ed17e163035e9dd9c493e5695512523a37b.tar.bz2 |
Linux capturer to invalidate the full screen by using screen width and height
Linux capturer didn't use the right width and height to invalidate the
screen region for capturing. Leading to a NULL pointer exception when doing
a XGetImage() on an empty rect.
BUG=None
TEST=Linux host doesn't crash
Review URL: http://codereview.chromium.org/6627025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77114 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | remoting/host/capturer.cc | 3 | ||||
-rw-r--r-- | remoting/host/capturer.h | 1 | ||||
-rw-r--r-- | remoting/host/capturer_linux.cc | 10 |
3 files changed, 11 insertions, 3 deletions
diff --git a/remoting/host/capturer.cc b/remoting/host/capturer.cc index 0dd09ab..fe9cb30 100644 --- a/remoting/host/capturer.cc +++ b/remoting/host/capturer.cc @@ -49,7 +49,8 @@ void Capturer::InvalidateFullScreen(int width, int height) { } void Capturer::InvalidateFullScreen() { - InvalidateFullScreen(width_most_recent_, height_most_recent_); + if (width_most_recent_ && height_most_recent_) + InvalidateFullScreen(width_most_recent_, height_most_recent_); } void Capturer::CaptureInvalidRects(CaptureCompletedCallback* callback) { diff --git a/remoting/host/capturer.h b/remoting/host/capturer.h index a91dcd7..8c4216e 100644 --- a/remoting/host/capturer.h +++ b/remoting/host/capturer.h @@ -62,6 +62,7 @@ class Capturer { void InvalidateRects(const InvalidRects& inval_rects); // Invalidate the entire screen, of a given size. + // TODO(hclam): No overload function! void InvalidateFullScreen(int width, int height); // Invalidate the entire screen, using the size of the most recently diff --git a/remoting/host/capturer_linux.cc b/remoting/host/capturer_linux.cc index 408eda0..d37f0ab 100644 --- a/remoting/host/capturer_linux.cc +++ b/remoting/host/capturer_linux.cc @@ -218,8 +218,13 @@ void CapturerLinuxPimpl::CalculateInvalidRects() { XDamageNotifyEvent *event = reinterpret_cast<XDamageNotifyEvent*>(&e); gfx::Rect damage_rect(event->area.x, event->area.y, event->area.width, event->area.height); + + // TODO(hclam): Perform more checks on the rect. + if (damage_rect.width() <= 0 && damage_rect.height() <= 0) + continue; + invalid_rects.insert(damage_rect); - VLOG(3) << "Damage receved for rect at (" + VLOG(3) << "Damage received for rect at (" << damage_rect.x() << "," << damage_rect.y() << ") size (" << damage_rect.width() << "," << damage_rect.height() << ")"; } @@ -229,7 +234,8 @@ void CapturerLinuxPimpl::CalculateInvalidRects() { } if (capture_fullscreen_) { - capturer_->InvalidateFullScreen(); + // TODO(hclam): Check the new dimension again. + capturer_->InvalidateFullScreen(width_, height_); capture_fullscreen_ = false; } else { capturer_->InvalidateRects(invalid_rects); |