Recent KHTML/Qt changes cause crash in Kopete

Peter Kelly pmk at kde.org
Sun Mar 9 22:54:49 GMT 2003


I've had a go at trying to reproduce the problem but without success (both 
with HEAD and KDE_3_1_BRANCH). Basically what I am doing to test it is 
just bring up an ICQ message dialog and type a message... but it appears 
in the window fine. When I tried it the other day though I did get a 
crash... has something else changed in the code recently that would affect 
this?

>From where the exception is being thrown it would appear that there is no 
document initialised at the time you are calling appendChild, i.e. 
chatView->htmlDocument().handle() == 0.

A possible fix, if the document is null in some situations would be 
something like the following:

  if (chatView->document().isNull()) {
    DOM::HTMLElement newNode =
      chatView->document().createElement(QString::fromLatin1("div") );
    newNode.setInnerHTML( resultHTML );
    chatView->htmlDocument().body().appendChild( newNode );
    if( !scrollPressed )
      QTimer::singleShot( 1, this, SLOT( slotScrollView() ) );
  }
  else {
    refreshView();
  }

On Mon, 3 Mar 2003, Nick Betcher wrote:

> > Which exception code is it? Could you provide a sample page that shows the
> > existing document structure and what you're trying to insert?
> 
> Ok, I put the exception catching in and I found out it's a NOT_FOUND_ERR. It 
> happens in '
> if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);' 
> (dom_node.cpp:~286). Again, our code is 
> 'chatView->htmlDocument().body().appendChild( newNode );'. Shouldn't the 
> body() node have a valid node implementation (in this case variable 'impl' in 
> dom_node.h)?
> 
> Our code is at 
> http://webcvs.kde.org/cgi-bin/cvsweb.cgi/~checkout~/kdenonbeta/kopete/libkopete/ui/chatview.cpp?rev=1.180&content-type=text/plain 
> .
> 
> 						Thanks
> 

-- 
Peter Kelly
pmk at kde.org



More information about the kfm-devel mailing list