首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用QtWebEngine退出QT崩溃

使用QtWebEngine退出QT崩溃
EN

Stack Overflow用户
提问于 2021-09-10 07:50:32
回答 1查看 448关注 0票数 0

因此,我在QML中使用WebEngineView,如下所示:

代码语言:javascript
复制
...
Loader {
    // some properties
    sourceComponent: WebEngineView {
        ...
    }
}

QQuickWebEngineProfile::defaultProfile()逻辑中,我在构造函数和析构函数中使用c++

代码语言:javascript
复制
MainViewModel(QObject* parent) : QObject(parent)
{
    // using QQuickWebEngineProfile::defaultProfile();
    // getting cookieStore of the profile and connect it to some slots
}

~MainViewModel()
{
    // using QQuickWebEngineProfile::defaultProfile();
    // getting cookieStore of the profile and disconnect it from MainViewModel
}

所以它运行得很好,但是当我试图关闭我的应用程序(调用qApp-> working ())时,它会崩溃。如果我从QML中删除WebEngineView,它就能工作;如果我删除defaultProfile()在c++中的使用,它就能工作。但我需要这些东西。

垃圾场:

代码语言:javascript
复制
1  _threadid                                                                                                                                        ucrtbased                    0x7ffb48687c75 
2  _threadid                                                                                                                                        ucrtbased                    0x7ffb48687e13 
3  abort                                                                                                                                            ucrtbased                    0x7ffb4869e01d 
4  `anonymous namespace'::messageHandler                                                                                                            application.cpp         46   0x7ff7c2d2b1bf 
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  0x7ffb4b2b5bda 
12 QQuickWebEngineViewPrivate::bindViewAndWidget                                                                                                    qquickwebengineview.cpp 972  0x7ffb4b2b5b6e 
13 QQuickWebEngineViewPrivate::releaseProfile                                                                                                       qquickwebengineview.cpp 200  0x7ffb4b2b2349 
14 QtWebEngineCore::ProfileAdapter::~ProfileAdapter                                                                                                 profile_adapter.cpp     127  0x7ffad4237f20 
15 QtWebEngineCore::ProfileAdapter::`vector deleting 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>>::reset             memory                  1910 0x7ffad4287857 
18 QtWebEngineCore::WebEngineContext::destroy                                                                                                       web_engine_context.cpp  339  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 
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-09-14 12:58:22

它试图进入当时已被删除的主窗口。为了解决这个问题,我不得不推迟销毁我的主窗口。我做过的

代码语言:javascript
复制
QObject::deleteLater()
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69128944

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档