| Index: ui/base/x/x11_util.cc
|
| diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc
|
| index 873996fd451f7b7ae3cbe9798b332282b70de9d1..4beee61d2d6035c3eb2a550526838bd94786cd6b 100644
|
| --- a/ui/base/x/x11_util.cc
|
| +++ b/ui/base/x/x11_util.cc
|
| @@ -113,12 +113,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) {
|
| @@ -133,6 +128,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_;
|
| @@ -215,8 +219,15 @@ int GetDefaultScreen(Display* display) {
|
| return XDefaultScreen(display);
|
| }
|
|
|
| +const int kCursorClearXCursorCache = -1;
|
| Cursor GetXCursor(int cursor_shape) {
|
| static XCursorCache cache;
|
| +
|
| + if (cursor_shape == kCursorClearXCursorCache) {
|
| + cache.Clear();
|
| + return NULL;
|
| + }
|
| +
|
| return cache.GetCursor(cursor_shape);
|
| }
|
|
|
|
|