diff options
author | varunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-10 01:50:30 +0000 |
---|---|---|
committer | varunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-10 01:50:30 +0000 |
commit | 58bbd265659f44fa5e362fd5fe6e38ea1671fdce (patch) | |
tree | 81862ebfabcb91d7f0ac9bf5fd21d7aecb90caab | |
parent | 5e2cb7cd5a794974e8a59266cd25d090e002fcc5 (diff) | |
download | chromium_src-58bbd265659f44fa5e362fd5fe6e38ea1671fdce.zip chromium_src-58bbd265659f44fa5e362fd5fe6e38ea1671fdce.tar.gz chromium_src-58bbd265659f44fa5e362fd5fe6e38ea1671fdce.tar.bz2 |
Check for null XDisplay in TouchFactory::SetCursorVisible
BUG=113456
TEST=none
Review URL: http://codereview.chromium.org/9370033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121373 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ui/base/touch/touch_factory.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/ui/base/touch/touch_factory.cc b/ui/base/touch/touch_factory.cc index cae979a..ea2731f 100644 --- a/ui/base/touch/touch_factory.cc +++ b/ui/base/touch/touch_factory.cc @@ -130,10 +130,13 @@ TouchFactory::~TouchFactory() { return; #endif - SetCursorVisible(true, false); - Display* display = ui::GetXDisplay(); - XFreeCursor(display, invisible_cursor_); - XFreeCursor(display, arrow_cursor_); + // The XDisplay may be lost by the time we get destroyed. + if (ui::XDisplayExists()) { + SetCursorVisible(true, false); + Display* display = ui::GetXDisplay(); + XFreeCursor(display, invisible_cursor_); + XFreeCursor(display, arrow_cursor_); + } } void TouchFactory::UpdateDeviceList(Display* display) { @@ -377,6 +380,10 @@ bool TouchFactory::UngrabTouchDevices(Display* display) { } void TouchFactory::SetCursorVisible(bool show, bool start_timer) { + // This function may get called after the display is terminated. + if (!ui::XDisplayExists()) + return; + #if defined(USE_AURA) if (!base::MessagePumpForUI::HasXInput2()) return; |