summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-21 17:12:21 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-21 17:12:21 +0000
commit9bf98f6112f3780034f8e8e3914f08ac7e5fabd5 (patch)
tree557044c69e43801bea28a8de95eb6d4cc92213a3 /chrome/browser
parenta5c9c5758bd83b035323493a5f46d18c9335b91d (diff)
downloadchromium_src-9bf98f6112f3780034f8e8e3914f08ac7e5fabd5.zip
chromium_src-9bf98f6112f3780034f8e8e3914f08ac7e5fabd5.tar.gz
chromium_src-9bf98f6112f3780034f8e8e3914f08ac7e5fabd5.tar.bz2
Handle a race between the remove tab animation resizing the closing tab and the gtk mouse events. Fixes a crash where the hover index would become stale before a leave-notify event.
BUG=10776 Review URL: http://codereview.chromium.org/88037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14115 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/gtk/tabs/tab_strip_gtk.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/gtk/tabs/tab_strip_gtk.cc
index 65e36d5..30bc408 100644
--- a/chrome/browser/gtk/tabs/tab_strip_gtk.cc
+++ b/chrome/browser/gtk/tabs/tab_strip_gtk.cc
@@ -248,6 +248,7 @@ class RemoveTabAnimation : public TabStripGtk::TabAnimation {
int index() const { return index_; }
protected:
+ virtual int GetDuration() const { return 5000; };
// Overridden from TabStripGtk::TabAnimation:
virtual double GetWidthForTab(int index) const {
TabGtk* tab = tabstrip_->GetTabAt(index);
@@ -1105,7 +1106,16 @@ gboolean TabStripGtk::OnLeaveNotify(GtkWidget* widget, GdkEventCrossing* event,
// A leave-notify-event is generated on mouse click, which sets the mode to
// GDK_CROSSING_GRAB. Ignore this event because it doesn't meant the mouse
// has left the tabstrip.
- if (tabstrip->hover_index_ != -1 && event->mode != GDK_CROSSING_GRAB) {
+ if (event->mode == GDK_CROSSING_GRAB)
+ return TRUE;
+
+ // There is a race between the remove tab animation and the hover index
+ // handling in OnMotionNotify. As the mouse leaves the tabstrip,
+ // OnMotionNotify figures out the hover index, the remove tab animation moves
+ // a frame, and the hover index becomes stale as OnLeaveNotify is called.
+ // The check against GetTabCount avoids this scenario.
+ if (tabstrip->hover_index_ != -1 &&
+ tabstrip->hover_index_ < tabstrip->GetTabCount()) {
tabstrip->GetTabAt(tabstrip->hover_index_)->OnLeaveNotify();
tabstrip->hover_index_ = -1;
gtk_widget_queue_draw(tabstrip->tabstrip_.get());