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

List:       pykde
Subject:    Re: [PyQt] QWebEnginePage.print() raises SIGSEGV
From:       Florian Bruhin <me () the-compiler ! org>
Date:       2019-04-08 17:04:15
Message-ID: 20190408170415.ak253f672yqdhbmg () hooch ! localdomain
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Mon, Apr 08, 2019 at 01:31:45PM -0300, Julio César Gázquez wrote:
> It results in the following, both in PyQt 5.12.1 from wheel and 5.10.1
> from Ubuntu repos: [...]

The Qt docs for QWebEnginePage::print say:

    It is the users responsibility to ensure the printer remains valid until
    resultCallback has been called.

So you'll need to make sure to keep a reference to the dialog (or the printer)
until the callback is called - for example, by using a nested function:

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

Florian

-- 
https://www.qutebrowser.org | me@the-compiler.org (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
         I love long mails! | https://email.is-not-s.ms/

["signature.asc" (application/pgp-signature)]
[Attachment #6 (text/plain)]

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


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

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