Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. QtWebKit segfault on javascript alert()
Forum Update on Monday, May 27th 2025

QtWebKit segfault on javascript alert()

Scheduled Pinned Locked Moved Qt WebKit
2 Posts 1 Posters 4.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Thijs
    wrote on last edited by
    #1

    I have an extremely simple demo program, but it crashes reliably on a javascript alert() :

    @
    #include <QtGui>
    #include <QtWebKit>

    int main(int argc, char * argv[])
    {
    QApplication app(argc, argv);
    QUrl url;
    url = QUrl("http://mytesturl.com/");

    QWebView *view = new QWebView(&#41;;
    view->load(url);
    view->show();
    
    return app.exec&#40;&#41;;
    

    }
    @

    it loads this html:

    @<!DOCTYPE HTML>
    <html>
    <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-type">
    <title>QtWebKit crash</title>
    </head>

    <body>
    [script type="text/javascript"]
    alert("welcome");
    [/script]
    </body>
    </html>@

    ps. replaced the brackets around the script tags with [ and ] , otherwise it gets removed...

    After clicking the "ok" button on the alert box, it always results in a SIGSEGV (Segmentation Fault). In Qt Creator (debug mode) I can see:

    @Dump of assembler code for function QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::data(void) const:
    End of assembler dump.@
    @0 QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::data qscopedpointer.h 135 0x680c876a
    1 qGetPtrHelper<QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> > > qglobal.h 2338 0x6801bdfd
    2 QHttpNetworkReply::d_func qhttpnetworkreply_p.h 161 0x680a7b0c
    3 QHttpNetworkConnectionChannel::_q_receiveReply qhttpnetworkconnectionchannel.cpp 362 0x68023867
    4 QHttpNetworkConnectionChannel::_q_readyRead qhttpnetworkconnectionchannel.cpp 883 0x68026401
    5 QHttpNetworkConnectionChannel::qt_metacall moc_qhttpnetworkconnectionchannel_p.cpp 92 0x68026d9b
    6 QMetaObject::metacall qmetaobject.cpp 237 0x6a2060b0
    7 QMetaObject::activate qobject.cpp 3278 0x6a216868
    8 QIODevice::readyRead moc_qiodevice.cpp 91 0x6a251a7d
    9 QAbstractSocketPrivate::canReadNotification qabstractsocket.cpp 639 0x68077aeb
    10 QAbstractSocketPrivate::readNotification qabstractsocket_p.h 77 0x680ac4a1
    11 QAbstractSocketEngine::readNotification qabstractsocketengine.cpp 154 0x68069165
    12 QReadNotifier::event qnativesocketengine.cpp 1103 0x6806b917
    13 QApplicationPrivate::notify_helper qapplication.cpp 4462 0x79bde0
    14 QApplication::notify qapplication.cpp 3862 0x799732
    15 QCoreApplication::notifyInternal qcoreapplication.cpp 731 0x6a2015f8
    16 QCoreApplication::sendEvent qcoreapplication.h 215 0x6a268308
    17 qt_internal_proc qeventdispatcher_win.cpp 485 0x6a224903
    18 USER32!GetDC C:\WINDOWS\system32\user32.dll 0 0x77d18734
    19 ?? 0 0x1b0714
    20 ?? 0 0x400
    ... <More> @

    Is this a known problem. If so, how to solve it? If I disable the alert() line, it will not crash.

    I'm using Qt Creator 2.1.0 (based on Qt 4.7.1 / 32 bit, Windows XP)). The fancybrowser demo doesn't appear to crash on this example, but it does crash on another test I have.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      Thijs
      wrote on last edited by
      #2

      I've filed a bug report here: https://bugs.webkit.org/show_bug.cgi?id=57414

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved