[PyQt] Bug in webengine callbacks

Phil Thompson phil at riverbankcomputing.com
Thu Sep 10 14:54:21 BST 2015


On 9 Sep 2015, at 5:44 pm, Kovid Goyal <kovid at kovidgoyal.net> wrote:
> 
> 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_()

Should be fixed in tonight's snapshot.

Thanks,
Phil


More information about the PyQt mailing list