summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorsnej@chromium.org <snej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-16 01:30:13 +0000
committersnej@chromium.org <snej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-16 01:30:13 +0000
commitdefda2819e4bc8311597273f5f98addd9d7a01c0 (patch)
tree0485af39d2a58872ee44a08930a6ea6ef515e8e2 /chrome
parentd25cdf7c017fbfb742044a46cc5c1aa2ed9b9536 (diff)
downloadchromium_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')
-rw-r--r--chrome/browser/cocoa/bookmark_manager_controller.h1
-rw-r--r--chrome/browser/cocoa/bookmark_manager_controller.mm21
2 files changed, 11 insertions, 11 deletions
diff --git a/chrome/browser/cocoa/bookmark_manager_controller.h b/chrome/browser/cocoa/bookmark_manager_controller.h
index 92eb2fa..6101419 100644
--- a/chrome/browser/cocoa/bookmark_manager_controller.h
+++ b/chrome/browser/cocoa/bookmark_manager_controller.h
@@ -24,6 +24,7 @@ class Profile;
Profile* profile_; // weak
scoped_ptr<BookmarkManagerBridge> bridge_;
scoped_nsobject<NSMapTable> nodeMap_;
+ scoped_nsobject<FakeBookmarkItem> root_; // Root of tree
scoped_nsobject<FakeBookmarkItem> searchGroup_; // Search Results group item
scoped_nsobject<FakeBookmarkItem> recentGroup_; // Recently-Added group item
}
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];
}
}