QWebEngineView error when using load () or page () method

I am working on porting a Qt 5.5 project, QWebView to Qt 5.6 (beta), QWebEngine. I went through the port explorer here . My code is as follows:

The .h file defines _view as follows:

QWebEngineView* _view;

and the .cpp constructor (inherited from QWidget) has:

QVBoxLayout* vbox = new QVBoxLayout(this);
_view = new QWebEngineView(this);
    connect(_view, SIGNAL(loadFinished(bool)), this, SLOT(loadPageFinished(bool)));
QString webDir = getReportBasePath() + no_tr("/index.html#") + startingPage;
//  QWebEnginePage *page = _view->page();   // <-- CRASH!!
_view->load( QUrl("file:///" + webDir ) );  // <-- CRASH!!
_view->show();
vbox->addWidget(_view);

Executing either the page () method or load (), all this happens with:

Unhandled exception at 0x67019C66 (Qt5Cored.dll) in qxs.exe: 0xC0000005: 
Access violation reading location 0x00000000.

I checked that the _view pointer is not NULL.

If you look at the documentation, they have an example here , which is almost identical to my code above. I also tried replacing the call to load () to be identical to them:

view->load(QUrl("http://qt-project.org/"));

and he still falls. Any ideas what might cause these crashes?

QWebEnginePage setPage() QWebEngineView? ( , ...) - Qt ( 32- MSVC 2013), ?

:

    Qt5WebEngineWidgetsd.dll!QWebEnginePagePrivate::QWebEnginePagePrivate(QWebEngineProfile * _profile) Line 95 C++
    Qt5WebEngineWidgetsd.dll!QWebEnginePage::QWebEnginePage(QObject * parent) Line 393  C++
    Qt5WebEngineWidgetsd.dll!QWebEngineView::page() Line 145    C++
    Qt5WebEngineWidgetsd.dll!QWebEngineView::load(const QUrl & url) Line 157    C++
    qxs.exe!ReportWidget::ReportWidget(QcaMain * qm, QWidget * parent, QString startingPage) Line 321   C++

:

QWebEnginePagePrivate::QWebEnginePagePrivate(QWebEngineProfile *_profile)
    : adapter(new WebContentsAdapter)
    , history(new QWebEngineHistory(new QWebEngineHistoryPrivate(this)))
    , profile(_profile ? _profile : QWebEngineProfile::defaultProfile())
    , settings(new QWebEngineSettings(profile->settings()))
    , view(0)
    , isLoading(false)
    , scriptCollection(new QWebEngineScriptCollectionPrivate(browserContextAdapter()->userScriptController(), adapter.data()))
    , m_backgroundColor(Qt::white)
    , fullscreenMode(false)
{
    memset(actions, 0, sizeof(actions));
}

, , , - _profile NULL, QWebEngineProfile :

QWebEnginePage* page = new QWebEnginePage(  QWebEngineProfile::defaultProfile(), _view );
_view->setPage( page );

qwebengineprofile.cpp :

static QWebEngineProfile* profile = new QWebEngineProfile(
            new QWebEngineProfilePrivate(BrowserContextAdapter::defaultContext()),
            BrowserContextAdapter::globalQObjectRoot());

:

    Qt5Cored.dll!convert_to_wchar_t_elided(wchar_t * d, unsigned int space, const char * s) Line 256    C++
    Qt5Cored.dll!qt_message_fatal(QtMsgType __formal, const QMessageLogContext & context, const QString & message) Line 1593    C++
    Qt5Cored.dll!QMessageLogger::fatal(const char * msg, ...) Line 784  C++
    Qt5WebEngineCored.dll!`anonymous namespace'::subProcessPath(void)   C++
    Qt5WebEngineCored.dll!WebEngineLibraryInfo::getPath(int)    C++
    Qt5WebEngineCored.dll!WebEngineContext::WebEngineContext(void)  C++
    Qt5WebEngineCored.dll!WebEngineContext::current(void)   C++
    Qt5WebEngineCored.dll!QtWebEngineCore::BrowserContextAdapter::defaultContext(void)  C++
>   Qt5WebEngineWidgetsd.dll!QWebEngineProfile::defaultProfile() Line 516   C++
+4
2

. , QWebEngine, . , . windeployqt.exe, , Qt .

qtwebengine_resources.pak
qtwebengine_resources_100p
qtwebengine_resources_200p.pak.pak
QtWebEngineProcess.exe
icudtl.dat  

, Qt 4.8 Qt whatnot . Qt 5.x QWebEngine , , , .

+6

Windows QTWEBENGINEPROCESS_PATH

:

QTWEBENGINEPROCESS_PATH C:\Qt\Qt5.6.0\5.6\msvc2013_64\bin\QtWebEngineProcess.exe

.

+1

Source: https://habr.com/ru/post/1628419/


All Articles