[PyQt] Segfault when setting QDialogButtonBox buttons from focus-lost signal

Valentin Valls valentin.valls at esrf.fr
Fri Feb 22 09:48:31 GMT 2019


Hi,

I fall down into a segfault caused by the use of QDialogButtonBox.

Clicking on a button from the box that is at the same time removed by a
focus signal created a segfault.

I used PyQt 5.11.3 and Python 3.5.

That's maybe a Qt issue, and maybe nothing can be done in PyQt. But i
case it can help, here is the sample to reproduce the issue.

- Set the focus to the line edit
- Click on the Abort button

Regards,

===========================

from PyQt5 import Qt

app = Qt.QApplication([])

dialog = Qt.QDialog()
layout = Qt.QVBoxLayout(dialog)
line = Qt.QLineEdit(dialog)
box = Qt.QDialogButtonBox(dialog)
box.setStandardButtons(Qt.QDialogButtonBox.Abort)
layout.addWidget(line)
layout.addWidget(box)

def update_box():
    box.setStandardButtons(Qt.QDialogButtonBox.Ok)

line.editingFinished.connect(update_box)

dialog.exec_()

-------------- next part --------------
A non-text attachment was scrubbed...
Name: valentin_valls.vcf
Type: text/x-vcard
Size: 293 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20190222/b4cd3d35/attachment.vcf>


More information about the PyQt mailing list