Skip to content

crash when loading a lot of images with Zn #1041

@plantec

Description

@plantec

try this.

| allImagesData loaded |
	allImagesData := (STONJSON fromString:
		                  'https://picsum.photos/list' asUrl
			                  retrieveContents).
	loaded := Array new: allImagesData size.

	[
		(allImagesData) withIndexDo: [ :imgData :idx |
				| loader |
				loader := [
					          | timesRetry byteArray |
					          timesRetry := 0.
					          [
						          (byteArray := [
							                        | url |
							                        url := ('https://unsplash.it/100/100/?image='
							                                , idx asString) asUrl.
							                        url retrieveContents ]
							                        on: Error
							                        do: [ ]) isNil and: [ timesRetry < 5 ] ]
						          whileTrue: [ timesRetry := timesRetry + 1 ].
					          byteArray ifNotNil: [
							          | form |
							          form := Form fromBinaryStream: byteArray readStream.
							          loaded at: idx put: form ] ] newProcess.
				loader priority: Processor systemBackgroundPriority.
				loader name: 'ToPicsum.photo Gallery element loader'.
				loader resume ] ] fork.
		loaded

It ends up with a segmentation fault

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions