From 074c6fcfeb61f7d325eb7021f62738940d583c20 Mon Sep 17 00:00:00 2001 From: "ben@chromium.org" Date: Thu, 23 Oct 2008 00:37:56 +0000 Subject: Fix crash due to NULL deref. http://crbug.com/3183 Review URL: http://codereview.chromium.org/8069 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3803 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/views/tabs/dragged_tab_controller.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/chrome/browser/views/tabs/dragged_tab_controller.cc b/chrome/browser/views/tabs/dragged_tab_controller.cc index 4f20e57..c5bf55a 100644 --- a/chrome/browser/views/tabs/dragged_tab_controller.cc +++ b/chrome/browser/views/tabs/dragged_tab_controller.cc @@ -498,8 +498,11 @@ void DraggedTabController::Detach() { TabStripModel* attached_model = attached_tabstrip_->model(); int index = attached_model->GetIndexOfTabContents(dragged_contents_); if (index >= 0 && index < attached_model->count()) { + // Sometimes, DetachTabContentsAt has consequences that result in + // attached_tabstrip_ being set to NULL, so we need to save it first. + TabStrip* attached_tabstrip = attached_tabstrip_; attached_model->DetachTabContentsAt(index); - attached_tabstrip_->SchedulePaint(); + attached_tabstrip->SchedulePaint(); } // If we've removed the last Tab from the TabStrip, hide the frame now. -- cgit v1.1