Index: ui/base/x/x11_util.cc |
diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc |
index dada148842cccc876d9cd8eb38a760a3804c2be9..aa11de8a78e7a5cba96ea19f6ca46780dd5bf640 100644 |
--- a/ui/base/x/x11_util.cc |
+++ b/ui/base/x/x11_util.cc |
@@ -114,12 +114,7 @@ class XCursorCache { |
public: |
XCursorCache() {} |
~XCursorCache() { |
- Display* display = base::MessagePumpForUI::GetDefaultXDisplay(); |
- for (std::map<int, Cursor>::iterator it = |
- cache_.begin(); it != cache_.end(); ++it) { |
- XFreeCursor(display, it->second); |
- } |
- cache_.clear(); |
+ Clear(); |
} |
Cursor GetCursor(int cursor_shape) { |
@@ -134,6 +129,15 @@ class XCursorCache { |
return it.first->second; |
} |
+ void Clear() { |
+ Display* display = base::MessagePumpForUI::GetDefaultXDisplay(); |
+ for (std::map<int, Cursor>::iterator it = |
+ cache_.begin(); it != cache_.end(); ++it) { |
+ XFreeCursor(display, it->second); |
+ } |
+ cache_.clear(); |
+ } |
+ |
private: |
// Maps X11 font cursor shapes to Cursor IDs. |
std::map<int, Cursor> cache_; |
@@ -218,6 +222,12 @@ int GetDefaultScreen(Display* display) { |
Cursor GetXCursor(int cursor_shape) { |
CR_DEFINE_STATIC_LOCAL(XCursorCache, cache, ()); |
+ |
+ if (cursor_shape == kCursorClearXCursorCache) { |
+ cache.Clear(); |
+ return 0; |
+ } |
+ |
return cache.GetCursor(cursor_shape); |
} |