View Full Version : qtwebkit crash

3rd April 2011, 13:02
hello, when i try to open the following link http://moztw.org/demo/audioplayer/ with my web browser, it crashes, i even tried to open it with fancy browser, same it crashes, but Arora don't crashes on oppening it, please i nedd help, the same thing happend when i try to open any html5 audio or video,

this is a part of my settings, i dont know what is wrong, or there is something else i should do, please help!

QWebSettings::globalSettings()->setAttribute(QWebSettings::OfflineStorageDatabaseE nabled,true); // important, to implement, for html5
QWebSettings::globalSettings()->setOfflineStoragePath ( qApp->applicationDirPath() + "/cache/" );

QWebSettings::globalSettings()->setAttribute(QWebSettings::OfflineWebApplicationCa cheEnabled,true);// important, to implement, for html5
QWebSettings::globalSettings()->setOfflineWebApplicationCachePath ( qApp->applicationDirPath() + "/cache/" );

QWebSettings::globalSettings()->setAttribute(QWebSettings::LocalStorageEnabled,tru e);// important, to implement, for html5
QWebSettings::globalSettings()->setLocalStoragePath ( qApp->applicationDirPath() + "/cache/");

4th April 2011, 07:51
What does your browsers crashing while opening some arbitrary web site have to do with Qt? What is "my web browser" or "fancy browser" anyway?

Let us for a moment assume that "my web browser" is something you have written using Qt and QtWebKit. What have you done to try to isolate where it crashes? Where does it crash? What does a backtrace look like? What do any on the lines of code you posted above have to do with it? Do you have the needed plugins/codecs to play OGG audio?

Does this problem have anything to do with your request here (http://www.qtcentre.org/threads/40298-segmentation-fault-in-qwebkit-url)?

4th April 2011, 08:17
no the two problems are not related, yes by my web browser, i meant a web browser a wrote using qt and QWebkit! yes i have the codecs to playogg audio, but i don't know what is wrong! this is what backtraces gives

#0 0x296235db in ?? ()
#1 0x13f6eaa0 in ?? ()
#3 0x13f6e9e4 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

it is not very helpful, i don't know where to start to handle this

4th April 2011, 08:35
This is an HTML 5 test page. Firefox handles it without any problems. I have no idea whether Webview will work with HTML 5, but the most likely explanation for a failure if it cannot is badly handled error conditions. Compiling and running a debug version would be helpful; a clue about where in your code the failure occurs, and examples of the code around that point, would also be worthwhile.

4th April 2011, 08:45
yes the version iam testing is a debug version, and that is what i get from backtrace, i will look at it again, but i don't know how to isolate the section of the code from where the problem comes from.

4th April 2011, 08:55
If you don't know how to manage a debugger, put print statements in your code at various points and send them to cerr. The failure point is somewhere between the last statement you see printed and the following one. You can quickly binary search your code to find the exact point of failure this way.

4th April 2011, 09:06
thanks alot, that will be helpfull, i will do it, and report here!

4th April 2011, 09:19
Post a one file example program that crashes on your system and tell us which platform you are targeting and perhaps someone else can reproduce the crash. The quick throw-together below doesn't crash for me on Linux (it does whinge about missing plugins though).

#include <QtGui>
#include <QtWebKit>
#include <QDebug>

int main(int argc, char *argv[])
QApplication app(argc, argv);


// These are your settings. Safe to have them all point to the same place?
QWebSettings *s = QWebSettings::globalSettings();
s->setAttribute(QWebSettings::OfflineStorageDatabaseE nabled, true);
s->setOfflineStoragePath(qApp->applicationDirPath() + "/cache/" );
s->setAttribute(QWebSettings::OfflineWebApplicationCa cheEnabled, true);
s->setOfflineWebApplicationCachePath(qApp->applicationDirPath() + "/cache/");
s->setAttribute(QWebSettings::LocalStorageEnabled, true);
s->setLocalStoragePath(qApp->applicationDirPath() + "/cache/");

QWebView wv;
QUrl url("http://moztw.org/demo/audioplayer/");
return app.exec();

4th April 2011, 15:30
i tried your code, it also crashes on my system, windows 7 64bit! but arora (a qtwebkit based browser) does'nt crash on openning the link, the what is wrong? please help

6th April 2011, 08:42
please help!!!!

7th April 2011, 01:26
Anything could be wrong and repeatedly saying "crashes on my system" doesn't provide any useful information to diagnose the problem. Are you building the code in 32 or 64-bit? Have you tried to run the short sample program in a debugger? Have you tried it on a 32-bit machine? Have you tried separating the three caches (see the comment in my example)? Is the applicationDirPath() writeable on your machine (it typically isn't in deployed applications on Windows 7)?

It's also largely irrelevant what Arora does; it was built with a different compiler, may be 32 rather than 64-bit, might be using internal codecs, etc.

7th April 2011, 08:29
it seem as it only does it in my machine, windows 7 64 bit! backtrace gave me something related with nero plugins... and i tested the code under a virtual windows xp, and no crash!