Need Help: new KHtmlPart crashes app
Jan.Kaiser at OnVista.de
Jan.Kaiser at OnVista.de
Tue Jun 3 14:57:26 BST 2003
Hello,
First of all: I am a newbie to KDE programming. So, please forgive me all
the stupid things in this mail.
My little program (code below) tries to access a DOM::Document from a html
page through KHTMLPart.document() method.
The program is a proof of concept of a "sloppy" HTML Dom Parser, which can
access the nodes of any HTML (not only XHTML) document (without
bringing up a GUI) and produce certain output.
The problem is that it exits with an instance of the KCrashManager that
reports the application exited with
SIGSEGV 11 and prints the following output:
================================================
[New Thread 16384 (LWP 22968)]
0x403e2477 in waitpid () from /lib/libc.so.6
#0 0x403e2477 in waitpid () from /lib/libc.so.6
#1 0x40546c89 in KCrash::defaultCrashHandler(int) ()
from /opt/kde3/lib/libkdecore.so.4
#2 0x414671ec in __pthread_sighandler () from /lib/libpthread.so.0
#3 <signal handler called>
#4 0x407a58ef in QPixmap::convertFromImage(QImage const&, int) ()
from /usr/lib/libqt-mt.so.3
#5 0x4085f118 in QPixmap::convertFromImage(QImage const&,
QPixmap::ColorMode)
() from /usr/lib/libqt-mt.so.3
#6 0x40529987 in KIconLoader::loadIcon(QString const&, KIcon::Group, int,
int, QString*, bool) const () from /opt/kde3/lib/libkdecore.so.4
#7 0x401d20e8 in khtml::Cache::init() () from /opt/kde3/lib/libkhtml.so.4
#8 0x40118c9c in KHTMLFactory::ref() () from /opt/kde3/lib/libkhtml.so.4
#9 0x40118da6 in KHTMLFactory::registerPart(KHTMLPart*) ()
from /opt/kde3/lib/libkhtml.so.4
#10 0x400f8fad in KHTMLPart::KHTMLPart(QWidget*, char const*, QObject*,
char const*, KHTMLPart::GUIProfile) () from /opt/kde3/lib/libkhtml.so.4
#11 0x08048c23 in main ()
#12 0x40348857 in __libc_start_main () from /lib/libc.so.6
================================================
This is the source:
#include <kapp.h>
#include <kurl.h>
#include <khtml_part.h>
#include <khtmlview.h>
#include <ostream.h>
#include <dom_doc.h>
int main(int argc, char* argv[])
{
KApplication a(argc, argv, "test", false, false);
cout << "created KApplication" << endl;
KURL url = KURL("http://www.kde.org/index.php");
cout << "created KURL" << endl;
KHTMLPart *w = new KHTMLPart(); // this crashes
cout << "created KHTMLPart" << endl;
if (w != 0)
{
w->openURL(url);
DOM::Document doc = w->document(); // at this point I will be lucky !!
}
else
cout << "w is null" << endl;
cout << "opened url" << endl;
return a.exec();
}
Since I think there is only an error in the creation of the KApplication /
KHTMLPart I hope
the problem can be found easily.
Thanks in advance, Jan
More information about the kfm-devel
mailing list