连接信号和插槽时出现分段错误

Segmentation fault when connecting a Signal and a Slot

我已将代码简化为以下几行:

#-*- coding:utf8 -*-

from PySide.QtCore import *
from PySide.QtGui import *
import sys

app = QApplication(sys.argv)

table = QTreeView()
table.setModel( QStandardItemModel() )

@Slot(QItemSelection, QItemSelection)
def someSlot(selected, deselected):
    print "Slot Triggered"
    # do something ...

table.selectionModel().selectionChanged.connect(someSlot) # <-- error caused by this line !

当我尝试将 Slot 连接到 selectionChanged Signal 时,出现分段错误:

Segmentation fault (core dumped)

我的代码有问题吗?

在应用处于 运行 时保持 selectionModel 引用:

#table.selectionModel().selectionChanged.connect(someSlot)
selectionModel = table.selectionModel()
selectionModel.selectionChanged.connect(someSlot)