diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-08 01:25:09 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-08 01:25:09 +0000 |
commit | 3e0f1a61581c8b4e36339c234348b646a823021b (patch) | |
tree | f9ff4e8836983d5c6c83426bd4b87ef0c6ed341c /chrome | |
parent | d3faa4da61902dd4bbf2718dfdeb88b6b2fdb895 (diff) | |
download | chromium_src-3e0f1a61581c8b4e36339c234348b646a823021b.zip chromium_src-3e0f1a61581c8b4e36339c234348b646a823021b.tar.gz chromium_src-3e0f1a61581c8b4e36339c234348b646a823021b.tar.bz2 |
Fix a crash on tab closure. We now use our own model data and check that the hovering index is not out of bounds.
BUG=9803
Review URL: http://codereview.chromium.org/62133
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13325 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/gtk/tabs/tab_strip_gtk.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/gtk/tabs/tab_strip_gtk.cc index 1c0e5c4..ff4b636 100644 --- a/chrome/browser/gtk/tabs/tab_strip_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_strip_gtk.cc @@ -456,8 +456,9 @@ gboolean TabStripGtk::OnMotionNotify(GtkWidget* widget, GdkEventMotion* event, // Get a rough estimate for which tab the mouse is over. int index = event->x / (tabstrip->current_unselected_width_ + kTabHOffset); - if (index >= tabstrip->model_->count()) { - if (old_hover_index != -1) { + int tab_count = tabstrip->GetTabCount(); + if (index >= tab_count) { + if (old_hover_index != -1 && old_hover_index < tab_count) { tabstrip->GetTabAt(old_hover_index)->SetHovering(false); gtk_widget_queue_draw(tabstrip->tabstrip_.get()); } @@ -481,7 +482,7 @@ gboolean TabStripGtk::OnMotionNotify(GtkWidget* widget, GdkEventMotion* event, } else if (tabstrip->model()->selected_index() != index && tabstrip->GetTabAt(index)->IsPointInBounds(coord)) { tabstrip->hover_index_ = index; - } else if (index < tabstrip->model_->count() - 1 && + } else if (index < tab_count - 1 && tabstrip->GetTabAt(index + 1)->IsPointInBounds(coord)) { tabstrip->hover_index_ = index + 1; } @@ -491,7 +492,7 @@ gboolean TabStripGtk::OnMotionNotify(GtkWidget* widget, GdkEventMotion* event, if (tabstrip->hover_index_ != -1) tabstrip->GetTabAt(tabstrip->hover_index_)->SetHovering(true); - if (old_hover_index != -1) + if (old_hover_index != -1 && old_hover_index < tab_count) tabstrip->GetTabAt(old_hover_index)->SetHovering(false); gtk_widget_queue_draw(tabstrip->tabstrip_.get()); |