[PyQt] Segmentation fault. What could be the cause?

Phil Thompson phil at riverbankcomputing.com
Tue May 1 21:39:09 BST 2012


On Tue, 01 May 2012 12:04:19 +0200, tuxor1337 at web.de wrote:
> Hi all,
> 
> in one of my SIP files I have this line (a class constructor):
> 
> MessageDialog(QMessageBox::Icon icon /TransferThis/,
>     const QString & title /TransferThis/,
>     const QString & text /TransferThis/,
>     QMessageBox::StandardButtons buttons /TransferThis/ = 
> QMessageBox::NoButton,
>     QWidget * parent /TransferThis/ = 0);
> 
> When refering to this constructor later in my Python code, the following

> lines will cause a segmentation fault
> 
> app = QApplication(argv)
> about = ui.MessageDialog(QMessageBox.Icon(QMessageBox.Information), 
> app.tr(argv[1]), app.tr(argv[2]), QMessageBox.No | QMessageBox.Yes)
> 
> Can this be caused by the TransferThis annotation? Or by the "&" C++ 
> reference to the QString? Or do you see something else, that's wrong 
> with this?
> 
> 
> ##################
> If you want to have a closer look at the project, see here:
> 
> https://github.com/tuxor1337/PyOnyx
> 
> The problematic line is in ui/message_dialog.sip.

You definitely need to remove all the /TransferThis/ except for the one on
the parent argument.

Phil


More information about the PyQt mailing list