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
diff --git a/remoting/host/capturer_linux.cc b/remoting/host/capturer_linux.cc
index 408eda06..d37f0ab5 100644
--- a/remoting/host/capturer_linux.cc
+++ b/remoting/host/capturer_linux.cc
@@ -218,8 +218,13 @@
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 @@
}
if (capture_fullscreen_) {
- capturer_->InvalidateFullScreen();
+ // TODO(hclam): Check the new dimension again.
+ capturer_->InvalidateFullScreen(width_, height_);
capture_fullscreen_ = false;
} else {
capturer_->InvalidateRects(invalid_rects);