[PyQt] Bug in webengine callbacks
Kovid Goyal
kovid at kovidgoyal.net
Wed Sep 9 17:44:17 BST 2015
The following test script crashes, because of the callback.
Interestingly the crash only happens when the callback is on a method
of a subclass of QObject. For instance, replace w.callback below with
print and the crash goes away.
#!/usr/bin/env python3
# vim:fileencoding=utf-8
from PyQt5.Qt import *
class W(QWebEngineView):
def callback(self, found):
print ('result of find', found)
app = QApplication([])
w = W()
w.setHtml('<p>a</p>')
QTimer.singleShot(10, lambda: w.findText('a', QWebEnginePage.FindFlags(0), w.callback))
w.show()
app.exec_()
The relevant bit of the backtrace:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff79bea02 in method_dealloc (im=0x7ffff6bf7f88) at Objects/classobject.c:193
193 Objects/classobject.c: No such file or directory.
(gdb) bt
#0 0x00007ffff79bea02 in method_dealloc (im=0x7ffff6bf7f88) at Objects/classobject.c:193
#1 0x00007ffff79f8c0d in tupledealloc (op=0x7fffd3eb6348) at Objects/tupleobject.c:236
#2 0x00007ffff79be69f in method_call (func=0x7fffd3fa88c8, arg=0x7fffd3eb6348, kw=0x0) at Objects/classobject.c:348
#3 0x00007ffff79a9528 in PyObject_Call (func=func at entry=0x7ffff5cfb188, arg=arg at entry=0x7fffd3eaf908, kw=<optimized out>) at Objects/abstract.c:2040
#4 0x00007ffff7a56867 in PyEval_CallObjectWithKeywords (func=0x7ffff5cfb188, arg=0x7fffd3eaf908, kw=<optimized out>) at Python/ceval.c:4114
#5 0x00007fffef9f37b4 in ?? () from /usr/lib/python3.4/site-packages/sip.so
#6 0x00007fffdb2c24a8 in ?? () from /usr/lib/python3.4/site-packages/PyQt5/QtWebEngineWidgets.so
#7 0x00007fffdb09b3c9 in ?? () from /usr/lib/libQt5WebEngineWidgets.so.5
--
_____________________________________
Dr. Kovid Goyal
http://www.kovidgoyal.net
http://calibre-ebook.com
_____________________________________
More information about the PyQt
mailing list