diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-09 16:34:12 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-09 16:34:12 +0000 |
commit | f2d447cfe0e1383b664f73db319d8fd097b3e15f (patch) | |
tree | 38e6d005adcd059fa242cf24d3e1868d9d4dd36b /chrome/browser/tabs | |
parent | 5a18973c436301794320afa7f4c56a7257a74c3d (diff) | |
download | chromium_src-f2d447cfe0e1383b664f73db319d8fd097b3e15f.zip chromium_src-f2d447cfe0e1383b664f73db319d8fd097b3e15f.tar.gz chromium_src-f2d447cfe0e1383b664f73db319d8fd097b3e15f.tar.bz2 |
Mac: Try to get tabpose unit tests working again.
The original problem was that the test plays an animation that outlives the test. When the animation is done, the tab strip model observer tries to unregister itself, but the registry died when the test exited already.
My faulty fix was to reset the observer as soon as the end animation starts. This has the problem that the end animation will try to access stale objects: TabContentss are destroyed when the test exits, but the exit animation still tries to access them when drawing ThumbnailLayers (because the observer didn't get a notification that these were dead, since it was unregistered).
This (hopefully better) fix now unregisters the observer directly before the tab strip goes away.
BUG= 54323,53893,54342
TEST=unit tests pass, valgrind stays green
Review URL: http://codereview.chromium.org/3304014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58945 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tabs')
-rw-r--r-- | chrome/browser/tabs/tab_strip_model.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc index 269de35..608f9a9 100644 --- a/chrome/browser/tabs/tab_strip_model.cc +++ b/chrome/browser/tabs/tab_strip_model.cc @@ -274,13 +274,14 @@ TabContents* TabStripModel::DetachTabContentsAt(int index) { next_selected_index = IndexOfNextNonPhantomTab(next_selected_index, -1); if (!HasNonPhantomTabs()) closing_all_ = true; - TabStripModelObservers::Iterator iter(observers_); - while (TabStripModelObserver* obs = iter.GetNext()) { - obs->TabDetachedAt(removed_contents, index); - if (!HasNonPhantomTabs()) - obs->TabStripEmpty(); - } - if (HasNonPhantomTabs()) { + FOR_EACH_OBSERVER(TabStripModelObserver, observers_, + TabDetachedAt(removed_contents, index)); + if (!HasNonPhantomTabs()) { + // TabDetachedAt() might unregister observers, so send |TabStripEmtpy()| in + // a second pass. + FOR_EACH_OBSERVER(TabStripModelObserver, observers_, + TabStripEmpty()); + } else { if (index == selected_index_) { ChangeSelectedContentsFrom(removed_contents, next_selected_index, false); } else if (index < selected_index_) { |