[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.5/kdelibs/khtml
From: Maks Orlovich <maksim () kde ! org>
Date: 2006-10-28 20:27:01
Message-ID: 1162067221.610552.3265.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 599857 by orlovich:
Prevent crash-inducing recursion of detach due to blur events
happening when widgets with focus get destroyed, by quietly shifting
the focus to the view...(#135384, probably #124342 --- best I can tell given
imperfect information); also affects some bugs which I separately closed as
non-reproducible, but which involved such a sequence
Also fixes freezing in #92497, as we no longer try to find something
to focus when nothing is focusable..
BUG:92497
BUG:124342
BUG:135384
M +9 -0 khtmlview.cpp
M +14 -3 xml/dom_docimpl.cpp
--- branches/KDE/3.5/kdelibs/khtml/khtmlview.cpp #599856:599857
@@ -2031,6 +2031,15 @@
DocumentImpl *doc = m_part->xmlDocImpl();
NodeImpl *oldFocusNode = doc->focusNode();
+
+ // See whether we're in the middle of detach. If so, we want to
+ // clear focus... The document code will be careful to not
+ // emit events in that case..
+ if (oldFocusNode && oldFocusNode->renderer() &&
+ !oldFocusNode->renderer()->parent()) {
+ doc->setFocusNode(0);
+ return true;
+ }
#if 1
// If the user has scrolled the document, then instead of picking
--- branches/KDE/3.5/kdelibs/khtml/xml/dom_docimpl.cpp #599856:599857
@@ -2227,6 +2227,13 @@
{
// don't process focus changes while detaching
if( !m_render ) return;
+
+ // We do want to blur if a widget is being detached,
+ // but we don't want to emit events since that
+ // triggers updateLayout() and may recurse detach()
+ bool widgetDetach = m_focusNode && m_focusNode != this &&
+ m_focusNode->renderer() && !m_focusNode->renderer()->parent();
+
// Make sure newFocusNode is actually in this document
if (newFocusNode && (newFocusNode->getDocument() != this))
return;
@@ -2241,8 +2248,11 @@
oldFocusNode->setActive(false);
oldFocusNode->setFocus(false);
- oldFocusNode->dispatchHTMLEvent(EventImpl::BLUR_EVENT,false,false);
- oldFocusNode->dispatchUIEvent(EventImpl::DOMFOCUSOUT_EVENT);
+
+ if (!widgetDetach) {
+ oldFocusNode->dispatchHTMLEvent(EventImpl::BLUR_EVENT,false,false);
+ oldFocusNode->dispatchUIEvent(EventImpl::DOMFOCUSOUT_EVENT);
+ }
if ((oldFocusNode == this) && oldFocusNode->hasOneRef()) {
oldFocusNode->deref(); // deletes this
return;
@@ -2278,7 +2288,8 @@
view()->setFocus();
}
- updateRendering();
+ if (!widgetDetach)
+ updateRendering();
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic