The problem is that SpMultipleSelectionModeis comparing FileReference's using identity. When using ==, you're checking if two FileReference objects are the same object in memory. For FileReferences, this will often return false, even when referring to the same file, because each time you create a FileReference (even for the same path), a new object is instantiated:
Question: Should SpCollectionListModel>>#indexOf:ifAbsent: use indexOf:ifAbsent: instead of identityIndexOf: anItem ifAbsent: aBlock at least for comparing FileReferences?
The problem is that
SpMultipleSelectionMode
is comparing FileReference's using identity. When using ==, you're checking if twoFileReference
objects are the same object in memory. For FileReferences, this will often return false, even when referring to the same file, because each time you create aFileReference
(even for the same path), a new object is instantiated:To reproduce, step into the following method:
Question: Should
SpCollectionListModel>>#indexOf:ifAbsent:
useindexOf:ifAbsent:
instead ofidentityIndexOf: anItem ifAbsent: aBlock
at least for comparing FileReferences?