首页 > 解决方案 > 加载 url 时 QWebView 崩溃

问题描述

我正在使用PySide2Maya 内部来创建一个小部件,该小部件QWebView将 google.com 加载到其showEvent.

我可以在 Maya 作为独立工具之外毫无问题地运行它,但是在 Maya 内部,当我使用它的load方法时它会立即崩溃。这很奇怪,因为当 Maya 崩溃时,我确实看到 google 已成功加载到我的小部件中。

我在 Centos 7 上使用 Maya 2018 扩展 4。有人可以确认这在你的机器上也崩溃了吗?

这是我正在运行的脚本,每次都会为我崩溃:

from PySide2 import QtWidgets
from PySide2 import QtWebKitWidgets


class BrowserTool(QtWidgets.QWidget):

    def __init__(self, parent=None):
        super(BrowserTool, self).__init__(parent)

        self.resize(800, 800)

        self.web_view = QtWebKitWidgets.QWebView(parent=self)

        self.main_layout = QtWidgets.QVBoxLayout()
        self.main_layout.addWidget(self.web_view)
        self.setLayout(self.main_layout)

    def showEvent(self, event):
        self.web_view.load("http://www.google.com")


tool = BrowserTool()
tool.show()

以下是 Maya 从其崩溃文件中吐出的内容:

//====================================================
//command history (most recent last):
//====================================================
//last tool: nurbsSelect
//====================================================
//panel with focus: scriptEditorPanel1
//visible panels:
// modelPanel4 outlinerPanel1 scriptEditorPanel1 
//====================================================
  /lib64/libc.so.6(+0x1617dc) [0x7f33f10707dc]
  OBJ_bsearch_ex
  /Volumes/apps/x86_64/maya/2018_EXT4/lib/libcrypto.so.6(+0x7e125) [0x7f334111b125]
  X509_OBJECT_retrieve_match
  X509_STORE_add_cert
  /Volumes/apps/x86_64/maya/2018_EXT4/lib/libQt5Network.so.5(+0xfd5dc) [0x7f33e4ddc5dc]
  /Volumes/apps/x86_64/maya/2018_EXT4/lib/libQt5Network.so.5(+0x100d9a) [0x7f33e4ddfd9a]
  /Volumes/apps/x86_64/maya/2018_EXT4/lib/libQt5Network.so.5(+0x103512) [0x7f33e4de2512]
  QSslSocket::startClientEncryption()
  /Volumes/apps/x86_64/maya/2018_EXT4/lib/libQt5Network.so.5(+0xeddb0) [0x7f33e4dccdb0]
  /Volumes/apps/x86_64/maya/2018_EXT4/lib/libQt5Network.so.5(+0xf56d9) [0x7f33e4dd46d9]
  QMetaObject::activate(QObject*, int, int, void**)
  /Volumes/apps/x86_64/maya/2018_EXT4/lib/libQt5Network.so.5(+0xcea6b) [0x7f33e4dada6b]
  /Volumes/apps/x86_64/maya/2018_EXT4/lib/libQt5Network.so.5(+0xd0b98) [0x7f33e4dafb98]
  /Volumes/apps/x86_64/maya/2018_EXT4/lib/libQt5Network.so.5(+0xd9165) [0x7f33e4db8165]
  QApplicationPrivate::notify_helper(QObject*, QEvent*)
  QApplication::notify(QObject*, QEvent*)
  /Volumes/apps/x86_64/maya/2018_EXT4/lib/libExtensionLayer.so(+0x1edc3c) [0x7f3400af0c3c]
  QCoreApplication::notifyInternal2(QObject*, QEvent*)
  /Volumes/apps/x86_64/maya/2018_EXT4/lib/libQt5Core.so.5(+0x2c3bfe) [0x7f33f6489bfe]
  g_main_context_dispatch
  /lib64/libglib-2.0.so.0(+0x4a818) [0x7f33dc8b1818]
  g_main_context_iteration
  QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
  QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)
  QThread::exec()
  /Volumes/apps/x86_64/maya/2018_EXT4/lib/libQt5Core.so.5(+0xaa9d3) [0x7f33f62709d3]
  /lib64/libpthread.so.0(+0x7e25) [0x7f33f12d9e25]
  clone

标签: pythonqtmayapyside2

解决方案


推荐阅读