title: QWebEngineView crashes on load() or page() method
body: <p>I'm working on porting a Qt 5.5, QWebView project to Qt 5.6 (beta), QWebEngine. I've gone through the porting guide <a href="https://wiki.qt.io/Porting_from_QtWebKit_to_QtWebEngine" rel="noreferrer">here</a>. My code looks like this:</p>
  
  <p>.h file defines _view like so:</p>
  
  <pre><code>QWebEngineView* _view;
  </code></pre>
  
  <p>and the .cpp constructor (class inherits from QWidget) has:</p>
  
  <pre><code>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-&gt;page();   // &lt;-- CRASH!!
  _view-&gt;load( QUrl("file:///" + webDir ) );  // &lt;-- CRASH!!
  _view-&gt;show();
  vbox-&gt;addWidget(_view);
  </code></pre>
  
  <p>Upon doing either the page() or load() method, the whole thing crashes with:</p>
  
  <pre><code>Unhandled exception at 0x67019C66 (Qt5Cored.dll) in qxs.exe: 0xC0000005: 
  Access violation reading location 0x00000000.
  </code></pre>
  
  <p>I've verified that the _view pointer is not null. </p>
  
  <p>If you look at the documentation, they have an example <a href="http://doc.qt.io/qt-5/qwebengineview.html#details" rel="noreferrer">here</a> that's almost identical to my code above. I've also tried replacing load() call to be identical to theirs:</p>
  
  <pre><code>view-&gt;load(QUrl("http://qt-project.org/"));
  </code></pre>
  
  <p>and it still crashes. Any ideas what could be causing these crashes?</p>
  
  <p>Do I need to create a QWebEnginePage first and setPage() on the QWebEngineView? (I'm assuming not...) Could it have something to do with the Qt binaries (pre-built for Windows 32-bit MSVC 2013) that I'm using?</p>
  
  <p>Relevant part of stack trace:</p>
  
  <pre><code>    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 &amp; url) Line 157    C++
      qxs.exe!ReportWidget::ReportWidget(QcaMain * qm, QWidget * parent, QString startingPage) Line 321   C++
  </code></pre>
  
  <p>It crashes here:</p>
  
  <pre><code>QWebEnginePagePrivate::QWebEnginePagePrivate(QWebEngineProfile *_profile)
      : adapter(new WebContentsAdapter)
      , history(new QWebEngineHistory(new QWebEngineHistoryPrivate(this)))
      , profile(_profile ? _profile : QWebEngineProfile::defaultProfile())
      , settings(new QWebEngineSettings(profile-&gt;settings()))
      , view(0)
      , isLoading(false)
      , scriptCollection(new QWebEngineScriptCollectionPrivate(browserContextAdapter()-&gt;userScriptController(), adapter.data()))
      , m_backgroundColor(Qt::white)
      , fullscreenMode(false)
  {
      memset(actions, 0, sizeof(actions));
  }
  </code></pre>
  
  <p>I thought maybe that had something to do with _profile being NULL, so I attempted to first set a QWebEngineProfile like so:</p>
  
  <pre><code>QWebEnginePage* page = new QWebEnginePage(  QWebEngineProfile::defaultProfile(), _view );
  _view-&gt;setPage( page );
  </code></pre>
  
  <p>Then it instead crashes in qwebengineprofile.cpp here:</p>
  
  <pre><code>static QWebEngineProfile* profile = new QWebEngineProfile(
              new QWebEngineProfilePrivate(BrowserContextAdapter::defaultContext()),
              BrowserContextAdapter::globalQObjectRoot());
  </code></pre>
  
  <p>with stack trace:</p>
  
  <pre><code>    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 &amp; context, const QString &amp; 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++
  &gt;   Qt5WebEngineWidgetsd.dll!QWebEngineProfile::defaultProfile() Line 516   C++
  </code></pre>