diff options
author | snej@chromium.org <snej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-16 01:30:13 +0000 |
---|---|---|
committer | snej@chromium.org <snej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-16 01:30:13 +0000 |
commit | defda2819e4bc8311597273f5f98addd9d7a01c0 (patch) | |
tree | 0485af39d2a58872ee44a08930a6ea6ef515e8e2 /chrome/browser/cocoa/bookmark_manager_controller.mm | |
parent | d25cdf7c017fbfb742044a46cc5c1aa2ed9b9536 (diff) | |
download | chromium_src-defda2819e4bc8311597273f5f98addd9d7a01c0.zip chromium_src-defda2819e4bc8311597273f5f98addd9d7a01c0.tar.gz chromium_src-defda2819e4bc8311597273f5f98addd9d7a01c0.tar.bz2 |
Mac bookmark manager: Fix memory leak
BUG=none
TEST=all the bookmark mgr test under valgrind...
Review URL: http://codereview.chromium.org/549075
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36441 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/bookmark_manager_controller.mm')
-rw-r--r-- | chrome/browser/cocoa/bookmark_manager_controller.mm | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/chrome/browser/cocoa/bookmark_manager_controller.mm b/chrome/browser/cocoa/bookmark_manager_controller.mm index f47f0c1..b5f6063 100644 --- a/chrome/browser/cocoa/bookmark_manager_controller.mm +++ b/chrome/browser/cocoa/bookmark_manager_controller.mm @@ -140,13 +140,13 @@ class BookmarkManagerBridge : public BookmarkModelObserver { other, recentGroup_.get(), nil]; - FakeBookmarkItem* root = [[FakeBookmarkItem alloc] initWithTitle:@"" - icon:nil - manager:self]; - [root setChildren:rootItems]; - [recentGroup_ setParent:root]; - [searchGroup_ setParent:root]; - [groupsController_ setGroup:root]; + root_.reset([[FakeBookmarkItem alloc] initWithTitle:@"" + icon:nil + manager:self]); + [root_ setChildren:rootItems]; + [recentGroup_ setParent:root_]; + [searchGroup_ setParent:root_]; + [groupsController_ setGroup:root_]; // Turning on autosave also loads and applies the settings, which we couldn't // do until setting up the data model, above. @@ -335,11 +335,10 @@ class BookmarkManagerBridge : public BookmarkModelObserver { } // Show searchGroup_ if it's not visible yet: - FakeBookmarkItem* root = (FakeBookmarkItem*)[groupsController_ group]; - NSArray* rootItems = [root children]; + NSArray* rootItems = [root_ children]; if (![rootItems containsObject:searchGroup_]) { - [root setChildren:[rootItems arrayByAddingObject:searchGroup_]]; - [self itemChanged:root childrenChanged:YES]; + [root_ setChildren:[rootItems arrayByAddingObject:searchGroup_]]; + [self itemChanged:root_ childrenChanged:YES]; } } |