Bonjour à tous

Je tente de faire un petit explorer de fichiers qui s'intègrera dans un application plus conséquente.
Tout s'exécute normalement, mais au bout d'un nombre(indéfini) de clics sur mon QTreeView afin d'ouvrir les répertoires, mon explorer plante avec le message suivant : Segmentation Fault(coredump)

Le code ci-dessous est une version très allégé de mon code mais il reproduit le même problème.

Si je supprime mon QSortFilterProxyModel et que mon QTreeview point directement sur le QFileSystemModel, le problème n'apparait plus.


Pour info je suis en :
Python 2.4.2
PyQt 4.4.2
Qt 4.5.0
SunOs 5.8


Merci pour votre aide
Jean

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
 
from PyQt4 import QtGui, QtCore
import sys
 
class Proxii(QtGui.QSortFilterProxyModel):
    def __init__(self, parent):
        QtGui.QSortFilterProxyModel.__init__(self, parent)
 
    def hasChildren(self, oModelIndex):
        oSourceIndex = self.mapToSource(oModelIndex)
        return self.sourceModel().hasChildren(oSourceIndex)
 
    def canFetchMore(self, oModelIndex):
        oSourceIndex = self.mapToSource(oModelIndex)
        return self.sourceModel().canFetchMore(oSourceIndex)
 
    def fetchMore(self, oModelIndex):
        oSourceIndex = self.mapToSource(oModelIndex)
        return self.sourceModel().fetchMore(oSourceIndex)
 
 
class testExplo(QtCore.QObject):
    def __init__(self):
        QtCore.QObject.__init__(self)
 
        self.myTreeView = QtGui.QTreeView()
        self.myProxy = Proxii(self.myTreeView)
        self.myModel = QtGui.QFileSystemModel(self.myTreeView)
 
        #-- Model
        self.myModel.setRootPath("/home/")
        #-- Proxi
        self.myProxy.setSourceModel(self.myModel)
        #-- treeview
        self.myTreeView.setModel(self.myProxy)
 
        rootModelIndex = self.myModel.index("/home/")
        rootProxyIndex = self.myProxy.mapFromSource(rootModelIndex)
        self.myTreeView.setRootIndex(rootProxyIndex)
 
        self.myTreeView.show()
 
app = QtGui.QApplication(sys.argv)
myExplo = testExplo()
end = app.exec_()