Bug 119895

Summary: [patch] DOM Tree viewer crashes when trying to go up with no node selected
Product: [Applications] konqueror Reporter: Dima Ryazanov <dima>
Component: khtmlAssignee: Leo Savernik <l.savernik>
Status: RESOLVED FIXED    
Severity: crash CC: christophe, faure, kde
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Dima Ryazanov 2006-01-11 01:47:13 UTC
Version:            (using KDE KDE 3.5.0)
Installed from:    Compiled From Sources
Compiler:          gcc version 4.0.2 (Gentoo 4.0.2-r3, pie-8.7.8) 
OS:                Linux

Enable the DOM Tree Viewer extension in Settings->Configure Extensions->Tools. Open the DOM Tree for some webpage. Delete the root node, then click the "Up" arrow. Konqueror crashes:

...
#4  0x43b5d84f in DOM::Node::Node () from /usr/kde/3.5/lib/libkhtml.so.4
#5  0xb7be7c13 in DOMTreeView::moveToParent ()
   from /usr/kde/3.5/lib/kde3/libdomtreeviewerplugin.so
#6  0xb7bf207d in DOMTreeView::qt_invoke ()
   from /usr/kde/3.5/lib/kde3/libdomtreeviewerplugin.so
#7  0x42576b51 in QObject::activate_signal () from /usr/qt/3/lib/libqt-mt.so.3
#8  0x42577088 in QObject::activate_signal () from /usr/qt/3/lib/libqt-mt.so.3
#9  0x42ea2b79 in KAction::activated () from /usr/kde/3.5/lib/libkdeui.so.4
...

This seems to fix it, though I don't know if it's the right thing to do:

--- kdeaddons-3.5.0/konq-plugins/domtreeviewer/domtreeview.cpp.orig     2006-01-10 16:29:19.000000000 -0800
+++ kdeaddons-3.5.0/konq-plugins/domtreeviewer/domtreeview.cpp  2006-01-10 16:29:49.000000000 -0800
@@ -725,7 +725,8 @@
   // Hope this isn't too smart.

   DOM::Node cur = infoNode;
-  if (cur.isNull()) cur = static_cast<DOMListViewItem *>(m_listView->currentItem())->node();
+  if (cur.isNull() && m_listView->currentItem())
+    cur = static_cast<DOMListViewItem *>(m_listView->currentItem())->node();

   if (cur.isNull()) return;
Comment 1 Tommi Tervo 2006-02-16 22:40:53 UTC
#4  0x4204a5e3 in Node (this=0xbfecb620, other=@0x38) at dom_node.cpp:141
#5  0x423a175c in DOMListViewItem::node (this=0x0) at domlistviewitem.h:48
#6  0x4239d0f1 in DOMTreeView::moveToParent (this=0x875a778)
    at domtreeview.cpp:728
#7  0x423a07e5 in DOMTreeView::qt_invoke (this=0x875a778, _id=52, 
    _o=0xbfecb6d8) at domtreeview.moc:240
#8  0x40d101f9 in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#9  0x40d106a0 in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#10 0x40534565 in KAction::activated (this=0x87839c0) at kaction.moc:176
#11 0x405353b1 in KAction::slotActivated (this=0x87839c0) at kaction.cpp:1102
#12 0x4053471c in KAction::slotButtonClicked (this=0x87839c0, state=LeftButton)
    at kaction.cpp:1147
#13 0x405389b5 in KAction::qt_invoke (this=0x87839c0, _id=17, _o=0xbfecb824)
    at kaction.moc:220
#14 0x40d101f9 in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#15 0x4060108d in KToolBarButton::buttonClicked (this=0x87aa548, t0=-83, 
    t1=LeftButton) at ktoolbarbutton.moc:154
#16 0x406012ff in KToolBarButton::mouseReleaseEvent (this=0x87aa548, 
    e=0xbfecbd24) at ktoolbarbutton.cpp:479
Comment 2 Leo Savernik 2006-04-20 23:57:37 UTC
Taking. I didn't know people actually *use* the dom tree viewer ;-)
Comment 3 Dima Ryazanov 2006-04-21 04:02:36 UTC
Actually, the tree viewer is *really* cool - mostly because it's also a tree editor.

Lots of sites rely on client-side security.

Accepting a license or other agreements becomes much more pleasant when I can edit the terms myself ;) (Nobody says that's forbidden... Or if someone does, the DOM tree viewer can fix that, too.)

But the DOM tree viewer does have some other bugs:
1) Repaint errors when moving/deleting nodes
2) "Delete" key is tied to two actions - both of them delete the node, but typing "Delete" brings up a popup-menu, asking to select the action.
3) Crashes when moving nodes in DOM::Node::insertBefore ()) - I'll see if I can figure out what's happening.
4) When moving nodes deep inside the tree, all open nodes that are about 7 levels deep automatically close (so the tree goes back to its original state)

These should probably be filed separately, though...
Comment 4 Leo Savernik 2006-04-21 17:15:45 UTC
Glad you like it :-)

Concerning your bugs: If (1) occurs within the domtreeviewer window, it is new to me and should be filed. If it occurs within the konqueror window (i. e. the webpage itself), it is not a domtreeviewer bug and should be filed against konqueror/khtml rendering.

I know already about (2) and don't have the slightest idea on how to fix it. 

(3) should be reported if you have a reliable way to reproduce it. 

Last but not least, (4) sounds like a usability issue. If you can come up with a good procedure (step-by-step description) that shows how it works and how it is supposed to work, put it in a bugreport of its own and stress that it's a usability bug.

Comment 5 Pino Toscano 2008-02-29 11:36:35 UTC
SVN commit 780505 by pino:

Do not crash when there is not an item selected, and asking to go to its parent.
(Usually happens on an empty tree.)

CCBUG: 119895


 M  +3 -1      domtreeview.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=780505
Comment 6 Pino Toscano 2008-02-29 11:46:27 UTC
SVN commit 780513 by pino:

Restrict the two Delete actions to their widgets, so they do not conflict.

CCBUG: 119895


 M  +1 -20     domtreeview.cpp  
 M  +4 -0      domtreewindow.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=780513
Comment 7 Christophe Marin 2008-04-06 15:37:39 UTC
The issue cannot be reproduced in trunk (rev. 793966).

Konqueror doesn't crash anymore when deleting the HTML from DOM tree viewer then clicking on the "up" button.
Comment 8 Michael Leupold 2008-04-06 15:40:43 UTC
Confirmed for 3.5.9. Clicking the up-button twice after removing the HTML node still crashes konqueror.
Comment 9 Nicolas L. 2010-08-14 11:09:52 UTC
is this bug still valid under kde 4 ?
Comment 10 David Faure 2010-11-22 01:33:36 UTC
This is fixed in KDE4 indeed. Other issues should be reported separately.