summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjasplin <qt-info@nokia.com>2009-06-02 08:57:42 (GMT)
committerjasplin <qt-info@nokia.com>2009-06-02 09:50:31 (GMT)
commit7314c07a3e443b1d5349b419a03db8d41ca43f7e (patch)
tree4e6c6c2fda0ecb8f1ac8f3fbbf40b59d8e79eaff
parent8f16a4f1638fd661e74c6aa60822cd9ef17e5003 (diff)
downloadQt-7314c07a3e443b1d5349b419a03db8d41ca43f7e.zip
Qt-7314c07a3e443b1d5349b419a03db8d41ca43f7e.tar.gz
Qt-7314c07a3e443b1d5349b419a03db8d41ca43f7e.tar.bz2
BT: Fixed crash on Mac caused by erroneous handling of native focus events.
On Mac, a widget with a NoFocus policy could still get focus (if only temporarily) as the result of a native focus event. In particular, a line edit with a completer should not lose focus (if only for a brief moment) as a result of the completer popup being shown. This will for example cause an item delegate to think that the user has navigated away from the cell and delete the line edit as a result. This will in turn cause the completer to access a null pointer. Reviewed-by: Richard Moe Gustavsen Task-number: 254456 and 254460
-rw-r--r--src/gui/kernel/qwidget_mac.mm5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index f863428..c82b87d 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -1296,8 +1296,11 @@ OSStatus QWidgetPrivate::qt_widget_event(EventHandlerCallRef er, EventRef event,
if(part == kControlFocusNoPart){
if (widget->hasFocus())
QApplicationPrivate::setFocusWidget(0, Qt::OtherFocusReason);
- } else
+ } else if (widget->focusPolicy() != Qt::NoFocus) {
widget->setFocus();
+ } else {
+ handled_event = false;
+ }
}
if(!HIObjectIsOfClass((HIObjectRef)hiview, kObjectQWidget))
CallNextEventHandler(er, event);