所以我在我的QML中這樣使用WebEngineView:
...
裝載器 {
//一些屬性。
sourceComponent。WebEngineView {
...
}
}
在c 邏輯中,我在構造器和析構器中使用了QickWebEngineProfile::defaultProfile()
。MainViewModel(QObject* parent) : QObject(father)
{
// using QQuickWebEngineProfile::defaultProfile();
//獲得組態檔的cookieStore并將其連接到一些槽中。
}
~MainViewModel()
{
//使用QQuickWebEngineProfile::defaultProfile();
//獲得組態檔的cookieStore,并將其與MainViewModel斷開連接。
}
所以它作業得很好,但是當我試圖關閉我的應用程式時(呼叫qApp->quit()),它崩潰了。如果我從QML中洗掉WebEngineView,它就會作業,如果我在C 中洗掉defaultProfile()的使用,它就會作業。但是我需要這些東西。
轉儲:
1 _threadid ucrtbased 0x7ffb48687c75
2 _threadid ucrtbased0x7ffb48687e13
3 abort ucrtbased 0x7ffb4869e01d
4 `anonymous namespace'::messageHandler application.cpp 46 0x7ff7c2d1bf
5 qt_message_print qlogging.cpp 1844 0x7ffb08317fdf
6 qt_message qlogging.cpp 379 0x7ffb08318657
7 QMessageLogger::fatal qlogging.cpp 890 0x7ffb08316612
8 qt_assert qglobal.cpp 3354 0x7ffb08307a48
9 QAccessible::registerAccessibleInterface qaccessible.cpp 747 0x7ffb01df22bd
10 QAccessible::uniqueId qaccessible.cpp 767 0x7ffb01df2247
11 QQuickWebEngineViewPrivate::widgetChanged qquickwebengineview.cpp 982 0x7ffb4b5bda
12 QQuickWebEngineViewPrivate::bindViewAndWidget qquickwebengineview.cpp 972 0x7ffb4b5b6e
13 QQuickWebEngineViewPrivate::releaseProfile qquickwebengineview.cpp 200 0x7ffb4b2349
14QtWebEngineCore::ProfileAdapter::~ProfileAdapter profile_adapter.cpp 127 0x7ffad4237f20
15 QtWebEngineCore::ProfileAdapter::`vector deleted destructor' Qt5WebEngineCored 0x7ffad4238678
16 std::default_delete<QtWebEngineCore::DevToolsFrontendQt::NetworkResourceLoader>。 operator() memory 1758 0x7ffad41d9a75
17 std::unique_ptr<QtWebEngineCore::WebChannelIPCTransportHost, std::default_delete<QtWebEngineCore: :WebChannelIPCTransportHost>>::重置記憶體 1910 0x7ffad4287857
18 QtWebEngineCore::WebEngineContext::destroy web_engine_context.cpp339 0x7ffad4295a87
19 QtWebEngineCore::WebEngineContext::destroyContextPostRoutine web_engine_context.cpp 425 0x7ffad4295bf8
20 qt_call_post_routines qcoreapplication.cpp 336 0x7ffb087276ef
21 QApplication::~QApplication qapplication.cpp 714 0x7ffb07767046 ...
...
30 main main.cpp 63 0x7ff7c21d4640
uj5u.com熱心網友回復:
它試圖訪問主視窗,而此刻主視窗已經被洗掉。為了解決這個問題,我不得不推遲銷毀我的主視窗。我已經用
做了QObject::deleteLater()
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/310176.html
標籤:
