Persistence of KParts plugins

Antonio Larrosa Jiménez larrosa at kde.org
Thu Jul 17 00:27:19 BST 2003


> > Any idea of what's going wrong?
> >
> 
> Your DOM tree keeps refcounts on KHTML's stuff, which can't destroy
> itself properly. 

I see.

> I'd suggest a deep copy of the DOM tree then (cloneNode(true)).

This is quite strange, but when using the operator = to make a "copy" it 
works well, but when using cloneNode (either with true or false parameter) 
then the web archiver seems to parse an empty document, so it does nothing 
and finish inmediately.

The actual code is:

if(part->document().ownerDocument().isNull())
  // my test page goes in this case
    m_document=part->document().cloneNode(true);
  else
    m_document=part->document().ownerDocument().cloneNode(true);
...
const DOM::Element element = (const DOM::Element) m_document;

// element.isNull() is true

const QString& nodeValue(m_document.nodeValue().string());

// and nodeValue is an empty string

Just removing the .cloneNode(true) makes it work (except by the crash when 
removing the KHTMLFactory )

But the problem seems to me that comes later from:

  try
  {
    // We might throw a DOM exception
    child = m_document.firstChild();
  }
  catch (...)
  {
    child = DOM::Node();
  }

as I've seen that firstChild() really throws an exception and so child is 
nullified and we cannot parse the actual document.
 
Any idea? Thanks a lot for your help so far.

Greetings,

--
Antonio Larrosa Jimenez
KDE developer - larrosa at kde.org
http://developer.kde.org/~larrosa/
The clash of ideas is the sound of freedom.




More information about the kfm-devel mailing list