Skip to content

Execute inUIProcessDo: when even there is no process #642

@labordep

Description

@labordep

The method BlElement>>inUIProcessDo: aBlock cannot value block when there is no uiProcess (nil).
This is the case when I'm writing basic unit tests.
I think it should be great to value block in all cases.
This can be use to build from the same way a BlElement inside or outside the graphic tree.

A fix can be:

inUIProcessDo: aBlock
	"Run the supplied block in the UI process.
	If the active process is already the UI process, evaluate immediately. 
	Otherwise, queue up for the next frame."

	| uiProcess |
	self isAttachedToSceneGraph ifTrue: [ 
		self space host uiProcessDo: [ :uiProc | uiProcess := uiProc ] ].

	(uiProcess  isNil or:[ uiProcess = Processor activeProcess ])
		ifTrue: [ aBlock value ]
		ifFalse: [ 
			self enqueueTask: (BlTaskAction new
					 action: aBlock;
					 yourself) ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions