Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Access violation in QQuickWebEngineViewPrivate::initializeProfile()



  • I'm working on a project using Qt 5.12.8 to embed the WebEngineView. If I embed the WebEngineView in a simple qml file and run only test part 1 things are working fine. However, if I run both test part 1 & test part 2 in sequence I get an access violation in QQuickWebEngineViewPrivate::initializeProfile().

    Test case using gtest framework

    TEST( QuickControlsLoadTest, DialogWebViewRaw )
    {
    	QUrl dirOfControls( "qml/DialogWebViewRaw.qml" );
    
    	{
                    // Test part 1
    		QCoreApplication::setOrganizationName( "Example" );
    		QApplication::setAttribute( Qt::AA_ShareOpenGLContexts ); // For WebView needed
    		QCoreApplication::setAttribute( Qt::AA_EnableHighDpiScaling );
    		int          m_argc( 1 );
    		char*        m_argv[1];
    		m_argv[0] = "";
    		QApplication app( m_argc, m_argv );
    
    		QtWebEngine::initialize();
    
    		QQmlApplicationEngine appEngine;
    		appEngine.load( dirOfControls );
    		//app.exec();
    	}
    	{
                    // Test part 2
    		QCoreApplication::setOrganizationName( "Example" );
    		QApplication::setAttribute( Qt::AA_ShareOpenGLContexts ); // For WebView needed
    		QCoreApplication::setAttribute( Qt::AA_EnableHighDpiScaling );
    		int          m_argc( 1 );
    		char*        m_argv[1];
    		m_argv[0] = "";
    		QApplication app( m_argc, m_argv );
    
    		QtWebEngine::initialize();
    
    		QQmlApplicationEngine appEngine;
    		appEngine.load( dirOfControls );
    		//app.exec();
    	}
    }
    

    DialogWebViewRaw.qml contains the following code

    import QtQuick 2.11
    import QtQuick.Window 2.2
    import QtQuick.Controls 2.4
    import QtQuick.Layouts 1.11
    import QtWebEngine 1.1
    
    ApplicationWindow {
    	id: window
    	title: "Web View"
    
    	ColumnLayout {
    
    		WebEngineView {
    			id: webView
    			//url: 'https://www.google.com/'
    			Layout.fillHeight: true
    			Layout.fillWidth: true
    		}
    	}
    }
    
    

    Call stack of access violation

    Qt5WebEngined.dll!QQuickWebEngineViewPrivate::initializeProfile() Line 181	C++
    Qt5WebEngined.dll!QQuickWebEngineView::componentComplete() Line 2092	C++
    Qt5Qmld.dll!QQmlObjectCreator::finalize(QQmlInstantiationInterrupt & interrupt) Line 1375	C++
    Qt5Qmld.dll!QQmlComponentPrivate::complete(QQmlEnginePrivate * enginePriv, QQmlComponentPrivate::ConstructionState * state) Line 937	C++
    Qt5Qmld.dll!QQmlComponentPrivate::completeCreate() Line 972	C++
    Qt5Qmld.dll!QQmlComponent::completeCreate() Line 964	C++
    Qt5Qmld.dll!QQmlComponent::create(QQmlContext * context) Line 798	C++
    Qt5Qmld.dll!QQmlApplicationEnginePrivate::finishLoad(QQmlComponent * c) Line 136	C++
    Qt5Qmld.dll!QQmlApplicationEnginePrivate::startLoad(const QUrl & url, const QByteArray & data, bool dataFlag) Line 121	C++
    Qt5Qmld.dll!QQmlApplicationEngine::load(const QUrl & url) Line 266	C++
    QuickTests.exe!QuickControlsLoadTest_DialogWebViewRaw_Test::TestBody() Line 98	C++
    
    

    Why I get this access violation? Is the WebEngineProfile deleted after execution of part 1 of test case above?
    I know the test doesn't makes much sense at all but I wonder why I get the error.

    I appreciate any help.


Log in to reply