[PyQt] Segfault on exit when dynamically created WebEngineView is destroyed explicitly

Kovid Goyal kovid at kovidgoyal.net
Tue Oct 27 17:47:17 GMT 2015


There are lots and lots of potential reference cycles in the QWebEngineView module
that can cause crashes while exiting, because they change the order in
which objects are garbage collected by the python garbase collector.

See all the hoops I had to jump through to make it work here:
https://github.com/kovidgoyal/vise/blob/master/vise/main.py#L195 In
particular sendPostedEvents() is required for deleteLater() to work.

And follow some of the break_cycles() methods. 

I doubt this is fixable at a PyQt level. There are fundamental problems
with juxtaposing two different object lifetime systems -- python's and
Qt's -- that have plagued PyQt for nearly a decade now.

One possible simple workaround is to simply disable the python garbage
on application exit. I prefer to manually break cycles, as that is
cleaner, but that may not be an option in more complex applications.

Kovid.

On Tue, Oct 27, 2015 at 04:52:57PM +0000, Milorad Pop-Tosic wrote:
> 
> Hi all,
> 
> I'm experiencing an issue in PyQt 5.5.1 whereby the process segfaults on exit when a dynamically created WebEngineView is explicitly destroyed.
> 
> See the following gist which demonstrates the problem:
> https://gist.github.com/poptosic/5ef2621aa06c1bee62ef
> 
> Run webenginetest.py and click "Load" to dynamically instantiate a WebEngineView followed by "Unload" to destroy it. When you exit the application you should see it segfault. Oddly, if you don't click "Unload", the process will shutdown cleanly.
> 
> Also, running WebEngineTest.qml with qmlscene always exits cleanly.
> 
> Environment:
> - Windows 10
> - Python 3.4.2 compiled with MSVC2013
> - Qt 5.5.1 (MSVC2013)
> - PyQt 5.5.1 and sip 4.17 (MSVC2013)
> 
> I also managed to reproduce this on Linux:
> - Python 3.4.3
> - Qt 5.5.0,
> - PyQt 5.5.0 and sip 4.16.9
> 
> Thank you,
> Milorad
> 

> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt


-- 
_____________________________________

Dr. Kovid Goyal 
http://www.kovidgoyal.net
http://calibre-ebook.com
_____________________________________


More information about the PyQt mailing list