[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: QWebEngineCertificateError::defer() segfaults
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2022-04-26 11:33:46
Message-ID: 58870738da19a42fa46ac4b953e6c45f () riverbankcomputing ! com
[Download RAW message or body]

On 22/04/2022 10:21, Florian Bruhin wrote:
> Hi,
> 
> The attached examples use QWebEngineCertificateError::defer() (added in
> Qt 5.14) to accept/reject certificates asynchronously:
> 
> https://doc.qt.io/qt-5/qwebenginecertificateerror.html#defer
> https://doc.qt.io/qt-6/qwebenginecertificateerror.html#defer
> 
> With PySide6, this seems to work properly: The page pauses loading, and
> after 1s, it gets shown.
> 
> With PyQt6 and PyQt5 (and PySide2), it segfaults.
> 
> PyQt5:
> 
> Thread 1 "python3" received signal SIGSEGV, Segmentation fault.
> QWebEngineCertificateError::ignoreCertificateError
> (this=0x7fffffffb3f0) at
> /usr/src/debug/qtwebengine/src/webenginewidgets/api/qwebenginecertificateerror.cpp:231
>  231	   d->ignoreCertificateError();
> (gdb) bt
> #0  QWebEngineCertificateError::ignoreCertificateError()
> (this=0x7fffffffb3f0) at
> /usr/src/debug/qtwebengine/src/webenginewidgets/api/qwebenginecertificateerror.cpp:231
>  #1  0x00007ffff726fc63 in
> meth_QWebEngineCertificateError_ignoreCertificateError(PyObject*,
> PyObject*) (sipSelf=<optimized out>, sipArgs=<optimized out>)
> at
> /usr/src/debug/PyQtWebEngine-5.15.5/build/QtWebEngineWidgets/sipQtWebEngineWidgetsQWebEngineCertificateError.cpp:236
>  [...]
> #4  0x00007fffdb53ed31 in PyQtSlot::call(_object*, _object*) const
> (this=0x5555566debe0, args=0x7ffff7490070, callable=0x7fff805b4270) at
> ../../qpy/QtCore/qpycore_pyqtslot.cpp:247
> [...]
> #11 0x00007ffff62343d4 in QSingleShotTimer::timeout()
> (this=0x5555560691d0) at .moc/qtimer.moc:130
> 
> PyQt6 (strangely I seem to be missing some debugging symbols):
> 
> #0  0x00007fffecca9050 in
> QtWebEngineCore::CertificateErrorController::answered() const () at
> /usr/lib/libQt6WebEngineCore.so.6
> #1  0x00007fffecca9075 in
> QtWebEngineCore::CertificateErrorController::accept(bool) () at
> /usr/lib/libQt6WebEngineCore.so.6
> [...]
> #4  0x00007ffff7d1d83b in PyObject_Call () at 
> /usr/lib/libpython3.10.so.1.0
> [...]
> #9  0x00007fffeb4dc676 in QObject::event(QEvent*) () at
> /usr/lib/libQt6Core.so.60

The issue seems to be the deletion of C++ objects when the event loop is 
running waiting for the timeout to occur.

The following at the start of the handlers seems to fix it...

err = QWebEngineCertificateError(err)

...but I don't know if that is the "correct solution" or just a 
workaround.

Phil


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic