Get error with QWebEngineView



  • Hello,
    i have this code:

    #include <QString>
    #include <QTimer>
    #include <QThread>
    #include <QTime>
    #include <QMainWindow>
    #include <QApplication>
    #include <QWebEngineView>
    
    int main(int argc, char *argv[])
    {
    
      QApplication app(argc, argv);
    
    
     QMainWindow *mainWin = new QMainWindow;
    
     QWebEngineView *view = new QWebEngineView;
     view->load(QUrl("http://qt.io/"));
     view->show();
     mainWin->setCentralWidget(view);
    
       mainWin->showMaximized();
       return app.exec();
    }
    
    

    And in the output i'll get this:

    Debuggen beginnt
    [1205/181633:ERROR:scoped_ole_initializer.cc(20)] Multiple OleInitialize() calls for thread 8904
    [1205/181634:ERROR:visitedlink_master.cc(73)] Failed to open file C:\Users\henri\AppData\Local\WebEngineView_Example\QtWebEngine\Default\Visited Links
    [1205/181639:INFO:CONSOLE(2)] "JQMIGRATE: Migrate is installed, version 1.4.1", source: https://d33sqmjvzgs8hq.cloudfront.net/wp-includes/js/jquery/jquery-migrate.min.js.gzip?ver=1.4.1 (2)
    [1205/181653:FATAL:resource_scheduler.cc(1051)] Check failed: client_map_.empty(). 
    Debuggen beendet
    

    Any idea how i can solv this?

    Thanks



  • Hi! You need to take of the lifetime of your QObjects ;)

    int main(int argc, char *argv[])
    {
    
        QApplication app(argc, argv);
        QMainWindow mainWin;
        QWebEngineView *view = new QWebEngineView(&mainWin);
        view->load(QUrl("http://qt.io/"));
        view->show();
        mainWin.setCentralWidget(view);
        mainWin.showMaximized();
        return app.exec();
    }
    


  • Debuggen beginnt
    [1205/192828:ERROR:scoped_ole_initializer.cc(20)] Multiple OleInitialize() calls for thread 9528
    [1205/192833:INFO:CONSOLE(2)] "JQMIGRATE: Migrate is installed, version 1.4.1", source: https://d33sqmjvzgs8hq.cloudfront.net/wp-includes/js/jquery/jquery-migrate.min.js.gzip?ver=1.4.1 (2)
    [1205/192846:INFO:CONSOLE(2)] "JQMIGRATE: Migrate is installed, version 1.4.1", source: https://d33sqmjvzgs8hq.cloudfront.net/wp-includes/js/jquery/jquery-migrate.min.js.gzip?ver=1.4.1 (2)
    Debuggen beendet
    


  • These messages aren't critical, you can ignore them. What's important is, that you don't crash the application anymore.