[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/khtml/xml
From: Maks Orlovich <maksim () kde ! org>
Date: 2009-09-27 0:12:23
Message-ID: 1254010343.671946.7696.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1028401 by orlovich:
Handle reentry of setFocusNode via blur event.
Fixes crashes on bahn.de
BUG:201159
BUG:207952
BUG:201208
BUG:204050
BUG:195710
BUG:177689
BUG:205967
BUG:186539
M +12 -4 dom_docimpl.cpp
--- trunk/KDE/kdelibs/khtml/xml/dom_docimpl.cpp #1028400:1028401
@@ -2452,8 +2452,11 @@
if (m_focusNode != newFocusNode) {
NodeImpl *oldFocusNode = m_focusNode;
- // Set focus on the new node
- m_focusNode = newFocusNode;
+
+ // We are blurring, so m_focusNode ATM is 0; this is observable to the
+ // event handlers.
+ m_focusNode = 0;
+
// Remove focus from the existing focus node (if any)
if (oldFocusNode) {
if (oldFocusNode->active())
@@ -2471,7 +2474,8 @@
oldFocusNode->dispatchUIEvent(EventImpl::DOMFOCUSOUT_EVENT);
if ((oldFocusNode == this) && oldFocusNode->hasOneRef()) {
- oldFocusNode->deref(); // deletes this
+ oldFocusNode->deref(); // may delete this, if there are not kids keeping it alive...
+ // so we better not add any.
return;
}
else {
@@ -2479,7 +2483,11 @@
}
}
- if (m_focusNode) {
+ // It's possible that one of the blur, etc. handlers has already set focus.
+ // in that case, we don't want to override it.
+ if (!m_focusNode && newFocusNode) {
+ // Set focus on the new node
+ m_focusNode = newFocusNode;
m_focusNode->ref();
m_focusNode->dispatchHTMLEvent(EventImpl::FOCUS_EVENT,false,false);
if (m_focusNode != newFocusNode) return;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic