PySide: Segfault(?) when using QItemSelectionModel with QListView

后端 未结 2 1897
野性不改
野性不改 2021-01-04 22:59

Same exact problem as this: Connecting QTableView selectionChanged signal produces segfault with PyQt

I have a QListView, and I want to call a function when an item

2条回答
  •  独厮守ぢ
    2021-01-04 23:23

    Same problem here: http://permalink.gmane.org/gmane.comp.lib.qt.pyside.devel/541

    And I also answered: http://permalink.gmane.org/gmane.comp.lib.qt.pyside.devel/542

    I suspect what happens is:

    self.server_list # local object
    .selectionModel() # call C++ method, wraps C++ object in Python object
    .selectionChanged # get property of object
    # selection model is now out of scope and gets garbage collected
    .connect(...) # OOPS! ...operating on object that no longer exists!
    

提交回复
热议问题