diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-15 18:04:02 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-15 18:04:02 +0000 |
commit | bebee5f93a17703b1751e9f9ab09ea61156f1283 (patch) | |
tree | bde538d4f950dc874874ef0a66aab6291775c710 | |
parent | ff3d5b6b9d183a4aea64a233a5fdbbee357d922a (diff) | |
download | chromium_src-bebee5f93a17703b1751e9f9ab09ea61156f1283.zip chromium_src-bebee5f93a17703b1751e9f9ab09ea61156f1283.tar.gz chromium_src-bebee5f93a17703b1751e9f9ab09ea61156f1283.tar.bz2 |
Adds some debugging code in hopes of isolating a crasher. From the
crash it appears that we're starting a drag for an index beyond that of
the model.
BUG=24132
TEST=none
Review URL: http://codereview.chromium.org/275023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29144 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/views/tabs/tab_strip.cc | 31 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_strip.h | 2 |
2 files changed, 32 insertions, 1 deletions
diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc index 052025e..950e233 100644 --- a/chrome/browser/views/tabs/tab_strip.cc +++ b/chrome/browser/views/tabs/tab_strip.cc @@ -1192,6 +1192,37 @@ void TabStrip::MaybeStartDrag(Tab* tab, const views::MouseEvent& event) { // the user is dragging. if (IsAnimating() || tab->closing() || !HasAvailableDragActions()) return; + int index = GetIndexOfTab(tab); + if (!model_->ContainsIndex(index)) { + // It appears to be possible for a drag to start with an invalid tab. + // This records some extra information in hopes of tracking down why. + // The string contains the following, in order: + // . If a drag is already in progress, a 'D'. + // . Index of tab the user is dragging. + // . Number of tabs. + // . Size of the model. + // . Indices of any tabs that are being closed. + // . ! end marker. + std::string tmp; + if (drag_controller_.get()) + tmp += "D"; + tmp += " " + IntToString(index); + tmp += " " + IntToString(GetTabCount()); + tmp += " " + IntToString(model_->count()); + for (int i = 0; i < GetTabCount(); ++i) { + if (GetTabAt(i)->closing()) + tmp += " " + IntToString(i); + } + tmp += "!"; // End marker so we know we got all closing tabs. + + volatile char tab_state[128]; + for (size_t i = 0; i < std::min(ARRAYSIZE_UNSAFE(tab_state), + tmp.size()); ++i) { + tab_state[i] = tmp[i]; + } + CHECK(false); + return; + } drag_controller_.reset(new DraggedTabController(tab, this)); drag_controller_->CaptureDragInfo(gfx::Point(event.x(), event.y())); } diff --git a/chrome/browser/views/tabs/tab_strip.h b/chrome/browser/views/tabs/tab_strip.h index 44ca864..782d6f9 100644 --- a/chrome/browser/views/tabs/tab_strip.h +++ b/chrome/browser/views/tabs/tab_strip.h @@ -46,7 +46,7 @@ class TabStrip : public views::View, public MessageLoopForUI::Observer, public TabStripWrapper { public: - TabStrip(TabStripModel* model); + explicit TabStrip(TabStripModel* model); virtual ~TabStrip(); // Returns true if the TabStrip can accept input events. This returns false |