diff options
author | Norwegian Rock Cat <qt-info@nokia.com> | 2009-04-07 13:30:12 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2009-04-08 02:33:15 (GMT) |
commit | 1da42bc25d414b52de0996608cbaf59c5cd3bf81 (patch) | |
tree | 7f5b926cda591a58f19d96cd426b81f8b9e3008f /src | |
parent | e0b90b6cdfea29a2362d3ba825be7a816eaa7332 (diff) | |
download | Qt-1da42bc25d414b52de0996608cbaf59c5cd3bf81.zip Qt-1da42bc25d414b52de0996608cbaf59c5cd3bf81.tar.gz Qt-1da42bc25d414b52de0996608cbaf59c5cd3bf81.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
(cherry picked from commit 773c4d326c24f8db12ab58e379bd223ce1126d72)
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qcocoapanel_mac.mm | 5 | ||||
-rw-r--r-- | src/gui/kernel/qcocoawindow_mac.mm | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/gui/kernel/qcocoapanel_mac.mm b/src/gui/kernel/qcocoapanel_mac.mm index c17b30c..95e20af 100644 --- a/src/gui/kernel/qcocoapanel_mac.mm +++ b/src/gui/kernel/qcocoapanel_mac.mm @@ -157,10 +157,11 @@ QT_USE_NAMESPACE [self release]; } - - (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]; } 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]; } |