summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qcocoawindow_mac.mm
diff options
context:
space:
mode:
authorNorwegian Rock Cat <qt-info@nokia.com>2009-04-07 13:30:12 (GMT)
committerNorwegian Rock Cat <qt-info@nokia.com>2009-04-07 13:35:47 (GMT)
commit773c4d326c24f8db12ab58e379bd223ce1126d72 (patch)
treee8ccabf955901f8eb4e8de44d70bb7e1f84b0ef4 /src/gui/kernel/qcocoawindow_mac.mm
parentde007bd2a20a141aefe901408512c806879a2387 (diff)
downloadQt-773c4d326c24f8db12ab58e379bd223ce1126d72.zip
Qt-773c4d326c24f8db12ab58e379bd223ce1126d72.tar.gz
Qt-773c4d326c24f8db12ab58e379bd223ce1126d72.tar.bz2
BT: Prevent a crash in Designer when quiting when in the filter edit.
Gah, my original change (f5ef0eb1a6543abdd29e07c23de7fa1128f6d623) had its heart in the right place, but it seems that it can cause crashes on closing where we refuse to give up the first responder and we end up with a dangling pointer. This lets that case happen (when we have no focus widget and are setting a nil first responder, there's no reason to stop that, but it refuses to do that when we do have a focus widget. Hopefully we don't get in a situation where our focus widget gets out of sync. Reviewed-by: Prasanth Ullattil
Diffstat (limited to 'src/gui/kernel/qcocoawindow_mac.mm')
-rw-r--r--src/gui/kernel/qcocoawindow_mac.mm4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/kernel/qcocoawindow_mac.mm b/src/gui/kernel/qcocoawindow_mac.mm
index ba121cd..e7b76a7 100644
--- a/src/gui/kernel/qcocoawindow_mac.mm
+++ b/src/gui/kernel/qcocoawindow_mac.mm
@@ -182,7 +182,9 @@ extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); // qcocoaview.
- (BOOL)makeFirstResponder:(NSResponder *)responder
{
- if (responder == nil)
+ // For some reason Cocoa wants to flip the first responder
+ // when Qt doesn't want to, sorry, but "No" :-)
+ if (responder == nil && qApp->focusWidget())
return NO;
return [super makeFirstResponder:responder];
}