[go: up one dir, main page]

Skip to content
This repository has been archived by the owner on Jul 2, 2023. It is now read-only.

Segmentation fault: 11 While emitting IR SIL function ... #30

Open
DianQK opened this issue Sep 20, 2019 · 1 comment
Open

Segmentation fault: 11 While emitting IR SIL function ... #30

DianQK opened this issue Sep 20, 2019 · 1 comment
Labels

Comments

@DianQK
Copy link
Owner
DianQK commented Sep 20, 2019

Maybe you will find Segmentation fault: 11 While emitting IR SIL function ... error info when use AnimatableCollectionViewProvider. This look like Swift bug.

This issue will closed when this error go away.

This code will cause Segmentation fault: 11:

class TestRadioProvider<Option: Equatable & StringIdentifiableType>: AnimatableCollectionViewProvider {
    func configureCell(_ collectionView: UICollectionView, cell: RadioCollectionViewCell, indexPath: IndexPath, value: Value) {
    }
    func createValues() -> Observable<[Value]> {
        return Observable.empty()
    }
    typealias Cell = RadioCollectionViewCell
    typealias Value = Option
}

There are some workaround methods:

add createAnimatableNodes:

class TestRadioProvider<Option: Equatable & StringIdentifiableType>: AnimatableCollectionViewProvider {
    func configureCell(_ collectionView: UICollectionView, cell: RadioCollectionViewCell, indexPath: IndexPath, value: Value) {
    }
    func createValues() -> Observable<[Value]> {
        return Observable.empty()
    }
    typealias Cell = RadioCollectionViewCell
    typealias Value = Option
    func createAnimatableNodes() -> Observable<[IdentifiableNode]> {
        let providerIdentity = self._flix_identity
        return createValues()
            .map { $0.map { IdentifiableNode(providerIdentity: providerIdentity, valueNode: $0) } }
    }
}

or add a model to warp this Option:

struct SegmentationFault11Warp<Value: Equatable & StringIdentifiableType>: Equatable & StringIdentifiableType {
    var identity: String {
        return value.identity
    }
    let value: Value
}

class TestRadioProvider<Option: Equatable & StringIdentifiableType>: AnimatableCollectionViewProvider {
    func configureCell(_ collectionView: UICollectionView, cell: RadioCollectionViewCell, indexPath: IndexPath, value: Value) {
    }
    func createValues() -> Observable<[Value]> {
        return Observable.empty()
    }
    typealias Cell = RadioCollectionViewCell
    typealias Value = SegmentationFault11Warp<Option>
}
@10000TB
Copy link
10000TB commented Sep 20, 2019

This very helpful !

@DianQK wondering how to explain the crash and your advised ways of workaround ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants