Bug 92497 - Konqueror freezes at ifilm.com when cookies are disabled
Summary: Konqueror freezes at ifilm.com when cookies are disabled
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
: 120558 122436 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-11-01 00:02 UTC by Dima Ryazanov
Modified: 2006-10-28 22:27 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dima Ryazanov 2004-11-01 00:02:17 UTC
Version:            (using KDE KDE 3.3.1)
Installed from:    Gentoo Packages
Compiler:          gcc version 3.3.4 20040623 gcc version 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6)
OS:                Linux

I have cookies disabled by default. When I go to http://www.ifilm.com/top100 and select something in the "Select a Channel" box, Konqueror always freezes. If I enable cookies, it seems to work right.
Comment 1 Tommi Tervo 2005-08-04 14:02:24 UTC
Gdb gave me following bt.

0x02bb4dba in DOM::NodeImpl::traverseNextNode (this=0x918b358, stayWithin=0x0)
    at dom_nodeimpl.cpp:701
701             while (n && !n->nextSibling() && (!stayWithin || n->parentNode() != stayWithin))
(gdb) bt
#0  0x02bb4dba in DOM::NodeImpl::traverseNextNode (this=0x918b358,
    stayWithin=0x0) at dom_nodeimpl.cpp:701
#1  0x02ba893b in DOM::DocumentImpl::nextFocusNode (this=0x911bf38,
    fromNode=0x918af88) at dom_docimpl.cpp:1376
#2  0x02b3a1c5 in KHTMLView::focusNextPrevNode (this=0x926b030, next=true)
    at khtmlview.cpp:2049
#3  0x02b38cff in KHTMLView::focusNextPrevChild (this=0x926b030, next=true)
    at khtmlview.cpp:1710
#4  0x02b38e6f in KHTMLView::focusNextPrevChild (this=0x8e3d560, next=true)
    at khtmlview.cpp:1721
#5  0x0236c87d in QWidget::hide () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#6  0x02c54409 in ~RenderWidget (this=0x8ebe1f0) at render_replaced.cpp:131
#7  0x02c6ed0e in ~RenderPart (this=0x8ebe1f0) at render_frames.cpp:556
#8  0x02c6ee5e in ~RenderPartObject (this=0x8ebe1f0) at render_frames.cpp:142
#9  0x02c28951 in khtml::RenderObject::arenaDelete (this=0x8ebe218,
    arena=0x9278e58, base=0x8ebe1f0) at render_object.cpp:1533
#10 0x02c289bb in khtml::RenderObject::arenaDelete (this=0x8ebe218,
    arena=0x9278e58) at render_object.cpp:1546
#11 0x02c56dcd in khtml::RenderWidget::deref (this=0x8ebe1f0)
    at render_replaced.cpp:804
#12 0x02c542d4 in khtml::RenderWidget::detach (this=0x8ebe1f0)
    at render_replaced.cpp:123
#13 0x02bb53b2 in DOM::NodeImpl::detach (this=0x9222c18)
Comment 2 Maksim Orlovich 2006-10-28 20:52:15 UTC
*** Bug 120558 has been marked as a duplicate of this bug. ***
Comment 3 Maksim Orlovich 2006-10-28 20:53:38 UTC
*** Bug 122436 has been marked as a duplicate of this bug. ***
Comment 4 Maksim Orlovich 2006-10-28 21:55:58 UTC
Note: #122436 has a URL where this basic bug is still reproducible..
Comment 5 Maksim Orlovich 2006-10-28 22:27:07 UTC
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();
     }
 }