[squeak-dev] ShoutCore background styling broken (FIX submitted to
inbox)
Marcel Taeumel
marcel.taeumel at student.hpi.uni-potsdam.de
Mon Dec 17 11:05:13 UTC 2012
Hi, there!
Im not exactly sure, how Squeak process scheduling works and at which points
in execution time a process is interrupted, but the old implementation of
background styling did not work in all cases:
SHTextStyler>>styleInBackgroundProcess: aText
self terminateBackgroundStylingProcess.
stylingEnabled ifTrue:[
text := aText copy.
self monitor critical: [
sem := Semaphore new.
[sem notNil
ifTrue: [
sem wait.
view ifNotNil:[view stylerStyledInBackground: text]]
] forkAt: Processor activePriority.
backgroundProcess :=
[self privateStyle: text.
sem signal]
forkAt: Processor userBackgroundPriority] ]
Especially for very long methods (700 lines auto-generated in my case),
#stylerStyledInBackground: was not executed in a safe way.
I removed the semaphore and used appropriate Morphic data structures:
SHTextStyler>>styleInBackgroundProcess: aText
self terminateBackgroundStylingProcess.
stylingEnabled ifTrue:[
text := aText copy.
self monitor critical: [
backgroundProcess := [
self privateStyle: text.
view ifNotNil: [:v |
WorldState addDeferredUIMessage: [v stylerStyledInBackground: text]].
] forkAt: Processor userBackgroundPriority] ].
It seems to work now. I submitted it to the inbox. As a drawback, it adds a
dependecy to Morphic. Well...
Best,
Marcel
--
View this message in context: http://forum.world.st/ShoutCore-background-styling-broken-FIX-submitted-to-inbox-tp4659580.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.
More information about the Squeak-dev
mailing list
|