summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/tabs
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-10 19:35:38 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-10 19:35:38 +0000
commitbc4ba49a5b5916fbd59194b09640b6a209bce40c (patch)
tree1d1b5d8bb8f10ff03d4fd6bf1672250710664059 /chrome/browser/views/tabs
parent0578a5011ceff5a50c9e2905d48d5747cf72569b (diff)
downloadchromium_src-bc4ba49a5b5916fbd59194b09640b6a209bce40c.zip
chromium_src-bc4ba49a5b5916fbd59194b09640b6a209bce40c.tar.gz
chromium_src-bc4ba49a5b5916fbd59194b09640b6a209bce40c.tar.bz2
Tweak delegate setting in the DraggedTabController to be more robust. Delegates should be NULLed more aggressively.
Review URL: http://codereview.chromium.org/10235 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5117 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/tabs')
-rw-r--r--chrome/browser/views/tabs/dragged_tab_controller.cc12
1 files changed, 2 insertions, 10 deletions
diff --git a/chrome/browser/views/tabs/dragged_tab_controller.cc b/chrome/browser/views/tabs/dragged_tab_controller.cc
index 4da9dba..38ab339 100644
--- a/chrome/browser/views/tabs/dragged_tab_controller.cc
+++ b/chrome/browser/views/tabs/dragged_tab_controller.cc
@@ -172,8 +172,6 @@ void DraggedTabController::NavigationStateChanged(const TabContents* source,
void DraggedTabController::ReplaceContents(TabContents* source,
TabContents* new_contents) {
DCHECK(dragged_contents_ == source);
- source->set_delegate(NULL);
- new_contents->set_delegate(this);
// If we're attached to a TabStrip, we need to tell the TabStrip that this
// TabContents was replaced.
@@ -292,12 +290,14 @@ gfx::Point DraggedTabController::GetWindowCreatePoint() const {
void DraggedTabController::ChangeDraggedContents(TabContents* new_contents) {
if (dragged_contents_) {
+ dragged_contents_->set_delegate(NULL);
NotificationService::current()->RemoveObserver(this,
NOTIFY_TAB_CONTENTS_DESTROYED,
Source<TabContents>(dragged_contents_));
}
dragged_contents_ = new_contents;
if (dragged_contents_) {
+ dragged_contents_->set_delegate(this);
NotificationService::current()->AddObserver(this,
NOTIFY_TAB_CONTENTS_DESTROYED,
Source<TabContents>(dragged_contents_));
@@ -642,14 +642,6 @@ void DraggedTabController::EndDragImpl(EndDragType type) {
destroy_now = CompleteDrag();
}
}
- } else {
- // If we get here it means the NavigationController is going down. Don't
- // attempt to do any cleanup other than resetting the delegate (if we're
- // still the delegate).
- if (dragged_contents_ && dragged_contents_->delegate() == this)
- dragged_contents_->set_delegate(NULL);
- dragged_contents_ = NULL;
- attached_tabstrip_ = NULL;
}
// If we're not destroyed now, we'll be destroyed asynchronously later.
if (destroy_now)