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

List:       pykde
Subject:    [PyQt] why QCompleter(parent) is TransferBack?
From:       Yuya Nishihara <yuya () tcha ! org>
Date:       2014-11-29 9:04:36
Message-ID: 20141129180436.398e64c283b1e1ea1df16ea4 () tcha ! org
[Download RAW message or body]

Hi,

I'm getting random crash around QCompleter.  The production code is not simple
but it roughly does:

    app = QApplication([])
    window = QMainWindow()
    lineedit = QLineEdit(window)
    window.setCentralWidget(lineedit)
    completer = QCompleter(window)
    completer.setModel(QDirModel(completer))
    lineedit.setCompleter(completer)
    window.show()
    app.exec_()

I looked into PyQt source and found that QCompleter(parent) is not annotated
as TransferThis.

    QCompleter(QObject *parent /TransferBack/ = 0);
    QCompleter(QAbstractItemModel *model, QObject *parent /TransferThis/ = 0);
    QCompleter(const QStringList &list, QObject *parent /TransferThis/ = 0);

So I've changed the above code as follows, and it seems the crash no longer
happen.

     window.setCentralWidget(lineedit)
    -completer = QCompleter(window)
    +completer = QCompleter([], window)
     completer.setModel(QDirModel(completer))

Is there a reason for setting TransferBack only to QCompleter(parent) ?

Platform: Debian sid amd64
PyQt: 4.11.2+dfsg-1

Regards,
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://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