Index: chrome/browser/ui/views/tabs/default_tab_drag_controller.cc |
diff --git a/chrome/browser/ui/views/tabs/default_tab_drag_controller.cc b/chrome/browser/ui/views/tabs/default_tab_drag_controller.cc |
index 00e509b3c3084d4abb9bb24f11c758c32111c9ca..cd76630f06cbf97ae092913ddf7712d653acac17 100644 |
--- a/chrome/browser/ui/views/tabs/default_tab_drag_controller.cc |
+++ b/chrome/browser/ui/views/tabs/default_tab_drag_controller.cc |
@@ -24,6 +24,7 @@ |
#include "content/browser/tab_contents/tab_contents.h" |
#include "content/browser/user_metrics.h" |
#include "content/public/browser/notification_details.h" |
+#include "content/public/browser/notification_service.h" |
#include "content/public/browser/notification_source.h" |
#include "content/public/browser/notification_types.h" |
#include "grit/theme_resources.h" |
@@ -360,6 +361,11 @@ void DefaultTabDragController::Init( |
} |
InitWindowCreatePoint(); |
initial_selection_model_.Copy(initial_selection_model); |
+ |
+ registrar_.Add( |
+ this, |
+ content::NOTIFICATION_TAB_CONTENTS_DELEGATE_DESTROYED, |
+ content::NotificationService::AllSources()); |
} |
void DefaultTabDragController::InitTabDragData(BaseTab* tab, |
@@ -471,6 +477,13 @@ void DefaultTabDragController::Observe( |
int type, |
const content::NotificationSource& source, |
const content::NotificationDetails& details) { |
+ if (type == content::NOTIFICATION_TAB_CONTENTS_DELEGATE_DESTROYED) { |
+ TabContentsDelegate* delegate = |
+ content::Source<TabContentsDelegate>(source).ptr(); |
+ for (size_t i = 0; i < drag_data_.size(); ++i) |
+ CHECK_NE(delegate, drag_data_[i].original_delegate); |
+ return; |
+ } |
DCHECK_EQ(type, content::NOTIFICATION_TAB_CONTENTS_DESTROYED); |
TabContents* destroyed_contents = content::Source<TabContents>(source).ptr(); |
for (size_t i = 0; i < drag_data_.size(); ++i) { |