QWebView crash when loading url

2019-09-05 14:42发布

问题:

When QWebView load some websites(when login to facebook, tumblr) it's crashes, is there something that should be enabled before open the url, i use Qt 5.5.1 here is the code

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);

    wv = new QWebView;
    wv->setParent(this);

    wv->load(QUrl("https://www.tumblr.com")); 
}

回答1:

You're facing bugs in an old Qt version. There's nothing for you to do other than updating Qt and switching to QWebEngineView, or using platform APIs directly to launch a browser widget, e.g. the internet explorer ActiveX control using ActiveQt on Windows, or using the WebView object on OS X.

If you're tied to Qt 5.5.1 and you insist on using its built-in webkit, you have no choice but to use a debug build of Qt, run your project under a debugger, see where it crashes, and see if there's an upstream fix for it (upstream meaning in the webkit project itself). You'd then need to backport the fix to the version of webkit bundled in Qt 5.5.1. You might need to repeat this process a few times, since I'd expect you to run into more than one crashing bug in code that old.



标签: c++ qt qwebview