Index: chrome/browser/ui/cocoa/draggable_button.mm |
diff --git a/chrome/browser/ui/cocoa/draggable_button.mm b/chrome/browser/ui/cocoa/draggable_button.mm |
index 91e8ef266f59d6ac9ac49819564edc756dea1816..1eb7d7dd7aa8c9e9773b98f4f7721976ce2589e7 100644 |
--- a/chrome/browser/ui/cocoa/draggable_button.mm |
+++ b/chrome/browser/ui/cocoa/draggable_button.mm |
@@ -36,6 +36,11 @@ |
} |
- (void)mouseDown:(NSEvent*)theEvent { |
+ // The impl spins an event loop to distinguish clicks from drags, |
+ // which could result in our destruction. Wire ourselves down for |
+ // the duration. |
+ scoped_nsobject<DraggableButton> keepAlive([self retain]); |
Robert Sesek
2011/08/23 22:56:48
Would it be better to do this in the impl?
Scott Hess - ex-Googler
2011/08/23 23:04:37
How?
Robert Sesek
2011/08/23 23:10:13
Retain button_ in the Impl in the loop?
|
+ |
if ([draggableButtonImpl_ mouseDownImpl:theEvent] == |
kDraggableButtonMixinCallSuper) { |
[super mouseDown:theEvent]; |