From b1a26cc8d92111b85944d01626dacab269011669 Mon Sep 17 00:00:00 2001 From: "viettrungluu@chromium.org" Date: Tue, 6 Oct 2009 00:29:04 +0000 Subject: Mac: Fix crash while dragging a tab alone in a window. Specifically, the crash could be repro'ed as follows (it also occurred under other circumstances as well): Have a window with one or more tabs in it. Create a new window with a single tab. Drag the tab in the new window, and while dragging right-click (and release). This patch also prevents right-clicks while dragging from stopping the drag. BUG=23591 TEST=See above. Review URL: http://codereview.chromium.org/242139 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28075 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/cocoa/tab_view.mm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'chrome/browser/cocoa/tab_view.mm') diff --git a/chrome/browser/cocoa/tab_view.mm b/chrome/browser/cocoa/tab_view.mm index 596bfe9..fd6a2a4 100644 --- a/chrome/browser/cocoa/tab_view.mm +++ b/chrome/browser/cocoa/tab_view.mm @@ -253,7 +253,7 @@ static const CGFloat kRapidCloseDist = 2.5; NSEventType type = [theEvent type]; if (type == NSLeftMouseDragged) { [self mouseDragged:theEvent]; - } else { // Mouse Up + } else if (type == NSLeftMouseUp) { NSPoint upLocation = [theEvent locationInWindow]; CGFloat dx = upLocation.x - downLocation.x; CGFloat dy = upLocation.y - downLocation.y; @@ -274,6 +274,12 @@ static const CGFloat kRapidCloseDist = 2.5; [self mouseUp:theEvent]; break; + } else { + // TODO(viettrungluu): [crbug.com/23830] We can receive right-mouse-ups + // (and maybe even others?) for reasons I don't understand. So we + // explicitly check for both events we're expecting, and log others. We + // should figure out what's going on. + LOG(WARNING) << "Spurious event received of type " << type << "."; } } } -- cgit v1.1