diff options
author | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-12 05:22:44 +0000 |
---|---|---|
committer | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-12 05:22:44 +0000 |
commit | e68e52e3142ba604bb2d29a1dde9a77c39b384d9 (patch) | |
tree | 013bb086a2bb058c7c6582682915515a4a842f6a /ui | |
parent | f0b2e6039456d18c850e5c8384e98dd9d0c8f806 (diff) | |
download | chromium_src-e68e52e3142ba604bb2d29a1dde9a77c39b384d9.zip chromium_src-e68e52e3142ba604bb2d29a1dde9a77c39b384d9.tar.gz chromium_src-e68e52e3142ba604bb2d29a1dde9a77c39b384d9.tar.bz2 |
aura: Fix crash in RootWindowHostX11::GetXImage().
r195926 accidentally broke a NULL check against
XGetImage()'s return value.
BUG=270311
Review URL: https://chromiumcodereview.appspot.com/22261009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@216933 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/aura/root_window_host_x11.cc | 28 | ||||
-rw-r--r-- | ui/aura/root_window_host_x11.h | 4 |
2 files changed, 9 insertions, 23 deletions
diff --git a/ui/aura/root_window_host_x11.cc b/ui/aura/root_window_host_x11.cc index ad1b957..f69a54a 100644 --- a/ui/aura/root_window_host_x11.cc +++ b/ui/aura/root_window_host_x11.cc @@ -822,12 +822,16 @@ void RootWindowHostX11::SetFocusWhenShown(bool focus_when_shown) { bool RootWindowHostX11::CopyAreaToSkCanvas(const gfx::Rect& source_bounds, const gfx::Point& dest_offset, SkCanvas* canvas) { - scoped_ptr<ui::XScopedImage> scoped_image(GetXImage(source_bounds)); - if (!scoped_image) + ui::XScopedImage scoped_image( + XGetImage(xdisplay_, xwindow_, + source_bounds.x(), source_bounds.y(), + source_bounds.width(), source_bounds.height(), + AllPlanes, ZPixmap)); + XImage* image = scoped_image.get(); + if (!image) { + LOG(ERROR) << "XGetImage failed"; return false; - - XImage* image = scoped_image->get(); - DCHECK(image); + } if (image->bits_per_pixel == 32) { if ((0xff << SK_R32_SHIFT) != image->red_mask || @@ -1085,20 +1089,6 @@ void RootWindowHostX11::TranslateAndDispatchMouseEvent( delegate_->OnHostMouseEvent(event); } -scoped_ptr<ui::XScopedImage> RootWindowHostX11::GetXImage( - const gfx::Rect& snapshot_bounds) { - scoped_ptr<ui::XScopedImage> image(new ui::XScopedImage( - XGetImage(xdisplay_, xwindow_, - snapshot_bounds.x(), snapshot_bounds.y(), - snapshot_bounds.width(), snapshot_bounds.height(), - AllPlanes, ZPixmap))); - if (!image) { - LOG(ERROR) << "XGetImage failed"; - image.reset(); - } - return image.Pass(); -} - void RootWindowHostX11::UpdateIsInternalDisplay() { RootWindow* root_window = GetRootWindow(); gfx::Screen* screen = gfx::Screen::GetScreenFor(root_window); diff --git a/ui/aura/root_window_host_x11.h b/ui/aura/root_window_host_x11.h index b3b2788..c38002d 100644 --- a/ui/aura/root_window_host_x11.h +++ b/ui/aura/root_window_host_x11.h @@ -96,10 +96,6 @@ class RootWindowHostX11 : public RootWindowHost, // dispatches the event to RootWindowHostDelegate. void TranslateAndDispatchMouseEvent(ui::MouseEvent* event); - // Copies and returns |snapshot_bounds| from |xwindow_|. Helper method for - // CopyAreaToSkCanvas() and GrabSnapshot(). - scoped_ptr<ui::XScopedImage> GetXImage(const gfx::Rect& snapshot_bounds); - // Update is_internal_display_ based on delegate_ state void UpdateIsInternalDisplay(); |