Issue #1267 resolved

pyqtSignal must be bound to a QObject

Anonymous created an issue



Mercurial version (1.9+10-e9264b45237d). TortoiseHg version (2.1.1) Command: --nofork workbench CWD: C:\projecten\2.0-shell-ing Extensions loaded: mercurial_keyring, purge Python version: 2.6.6 (r266:84297, Aug 24 2010, 18:13:38) [MSC v.1500 64 bit (AMD64)] Windows version: (6, 1, 7601, 2, 'Service Pack 1') Processor architecture: x64 Qt-4.7.1 PyQt-4.8.3 Traceback (most recent call last): File "tortoisehg\hgqt\repomodel.pyo", line 139, in <lambda> TypeError: pyqtSignal must be bound to a QObject, not 'HgRepoListModel' Traceback (most recent call last): File "tortoisehg\hgqt\repomodel.pyo", line 139, in <lambda> TypeError: pyqtSignal must be bound to a QObject, not 'HgRepoListModel'


Comments (7)

  1. Yuya Nishihara

    To reproduce it...

    Wow, that helped a lot, thanks. This issue happens due to two separate problems:

    1. revset query issued unintentionally when closing repository tab. I guess revsetcombo.activated is not good choice for trigerring runQuery().
    2. HgRepoListModel.setBranch emits self.filled with slight delay using Python lambda, which confuses lifetime of Qt objects.

    Thus, closing repo tab triggers reloading HgRepoListModel, but which is deleted immediately. Even after the deletion of underlying QAbstractTableModel, QTimer object still alive, and tries to invoke self.filled.emit(), leading "pyqtSignal must be bound to a QObject" error.

  2. Yuya Nishihara

    repomodel: avoid filled.emit() of destroyed HgRepoListModel (fixes #1267)

    If QTimer is connected to lambda, it will be alive even after QObject-part of HgRepoListModel destroyed. As a result, it tries to emit unbound filled signal causing TypeError, or "underlying C/C++ object has been deleted" error.

    → <<cset 43fada9fc1ce>>

  3. Yuya Nishihara

    repofilter: restore index of revset combobox to avoid extra activated signal

    If edit text matches combobox item but current index is different, it seems activated signal emitted on each focus-in/out event. It leads unintended revset query and causes problem when closing RepoWidget (refs #1267).

    → <<cset d1be42dde1ba>>

  4. Yuya Nishihara

    repomodel: use old-style signal for QTimer.singleShot connection (fixes #2239)

    PyQt 4.7.4 does not support new-style signal-signal connection for this case.

    v4.7.5 31st August 2010 - A signal defined with pyqtSignal() can now be used with methods that make an internal call to QObject::connect(), e.g. QTimer.singleShot().

    Also note that:

    • QTimer.singleShot(0, lambda: self.filled.emit()) confuses lifetime of QObject (refs #1267)
    • QTimer.singleShot(0, self.filled.emit) segfaults if self has been destroyed

    → <<cset fdde19e206c6>>

  5. Log in to comment