QWebEnginePage.print() raises SIGSEGV

Julio César Gázquez <[email protected]>
Newsgroups gmane.comp.python.pyqt-pykde
Message-ID <[email protected]>
Hi Phil.

Please check the following:


-----8<-----

from PyQt5 import QtWidgets, QtWebEngineWidgets, QtPrintSupport


def cleanup():
    pass


def print_page():
    dialog = QtPrintSupport.QPrintDialog(w)
    if dialog.exec_() == QtPrintSupport.QPrintDialog.Accepted:
        page.print(dialog.printer(), cleanup)

app = QtWidgets.QApplication([])

html = "<html><body>Hello world</body></html>"
page = QtWebEngineWidgets.QWebEnginePage()
page.setHtml(html)

w = QtWidgets.QPushButton("Print")
w.clicked.connect(print_page)
w.show()

app.exec_()


-----8<-----

It results in the following, both in PyQt 5.12.1 from wheel and 5.10.1
from Ubuntu repos:


Received signal 11 SEGV_MAPERR 000000000040
#0 0x7f191d6db8bf <unknown>
#1 0x7f191d6dbcbb <unknown>
#2 0x7f191d6dc33e <unknown>
#3 0x7f192b1e6f20 <unknown>
#4 0x7f191aad9ba3 QPrinter::pageRect()
#5 0x7f19228694ad printPdfDataOnPrinter()
#6 0x7f1922869946 QWebEnginePagePrivate::didPrintPage()
#7 0x7f191bc0bf09 <unknown>
#8 0x7f191d63e247 <unknown>
#9 0x7f191d664b67 <unknown>
#10 0x7f191d6651cd <unknown>
#11 0x7f191d66549a <unknown>
#12 0x7f191bb9deaf <unknown>
#13 0x7f192819489b QObject::event()
#14 0x7f192900f6fc QApplicationPrivate::notify_helper()
#15 0x7f19290167f0 QApplication::notify()
#16 0x7f1929a69f5e sipQApplication::notify()
#17 0x7f1928167e98 QCoreApplication::notifyInternal2()
#18 0x7f192816a937 QCoreApplicationPrivate::sendPostedEvents()
#19 0x7f19281bfc93 postEventSourceDispatch()
#20 0x7f1924fc8387 g_main_context_dispatch
#21 0x7f1924fc85c0 <unknown>
#22 0x7f1924fc864c g_main_context_iteration
#23 0x7f19281bf2cf QEventDispatcherGlib::processEvents()
#24 0x7f19281667fa QEventLoop::exec()
#25 0x7f192816f270 QCoreApplication::exec()
#26 0x7f19298f5480 meth_QApplication_exec_
#27 0x000000502d6f <unknown>
#28 0x000000506859 _PyEval_EvalFrameDefault
#29 0x000000504c28 <unknown>
#30 0x000000506393 PyEval_EvalCode
#31 0x000000634d52 <unknown>
#32 0x000000634e0a PyRun_FileExFlags
#33 0x0000006385c8 PyRun_SimpleFileExFlags
#34 0x00000063915a Py_Main
#35 0x0000004a6f10 main
#36 0x7f192b1c9b97 __libc_start_main
#37 0x0000005afa0a _start
  r8: 3c0a6a626f203020  r9: 6f74616572432f3c r10: 6d6f726843282072 r11:
72502f0a296d7569
 r12: 00000000023f3d80 r13: 00007ffcd6fb5110 r14: 00007f1922869920 r15:
00007f19226f2e70
  di: 00000000023f3d80  si: 00000000023f3d80  bp: 00007ffcd6fb5140  bx:
00007ffcd6fb4f90
  dx: 0000000000000009  ax: 0000000000000030  cx: 282072656375646f  sp:
00007ffcd6fb4f80
  ip: 00007f191aad9ba3 efl: 0000000000010202 cgf: 002b000000000033 erf:
0000000000000004
 trp: 000000000000000e msk: 0000000000000000 cr2: 0000000000000040
[end of stack trace]
Calling _exit(1). Core file will not be generated.


Greetings.

Julio.

_______________________________________________
PyQt mailing list    [email protected]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.