Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Unified Diff: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc

Issue 134103006: linux_aura: Fix cursor memeory leak, which was redding the lsan bot. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: +comment Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
index 37da13a326cb77550cf604e03d19f9f90330be26..2c4f085143092bf4517d226f06b3c13d6aa9b762 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
@@ -210,6 +210,7 @@ class FocusManagerEventHandler : public ui::EventHandler {
////////////////////////////////////////////////////////////////////////////////
// DesktopNativeWidgetAura, public:
+int DesktopNativeWidgetAura::cursor_reference_count_ = 0;
DesktopNativeCursorManager* DesktopNativeWidgetAura::native_cursor_manager_ =
NULL;
views::corewm::CursorManager* DesktopNativeWidgetAura::cursor_manager_ = NULL;
@@ -301,6 +302,15 @@ void DesktopNativeWidgetAura::OnDesktopWindowTreeHostDestroyed(
aura::client::SetCursorClient(root->window(), NULL);
native_cursor_manager_->RemoveRootWindow(root);
+ cursor_reference_count_--;
+ if (cursor_reference_count_ == 0) {
+ // We are the last DesktopNativeWidgetAura instance, and we are responsible
+ // for cleaning up |cursor_manager_|.
+ delete cursor_manager_;
+ native_cursor_manager_ = NULL;
+ cursor_manager_ = NULL;
+ }
sadrul 2014/01/15 22:15:01 This looks a bit hairy. Perhaps there could be a [
+
aura::client::SetScreenPositionClient(root->window(), NULL);
position_client_.reset();
@@ -397,6 +407,7 @@ void DesktopNativeWidgetAura::InitNativeWidget(
// |root_window_| must be added to |native_cursor_manager_| before
// OnRootWindowCreated() is called.
+ cursor_reference_count_++;
if (!native_cursor_manager_) {
native_cursor_manager_ = new DesktopNativeCursorManager(
DesktopCursorLoaderUpdater::Create());
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698