<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000">
                                        
                                        
                                            
                                        
                                        
                                        Hi Levente,<div><br></div><div>hmmm... I think the styler should silently discard the results then.</div><div><br></div><div>Okay, if the view became nil somehow, there shouldn't be too many debuggers anyway. So, it's unlikely and not even risky for the entire environment if it would happen. <span style="font-size: 10pt;line-height: 1.5">Well, messing around with instances of styler might not be as dangerous as is fiddling in the caverns of text rendering. :-)</span></div><div><span style="font-size: 10pt;line-height: 1.5"><br></span></div><div><span style="font-size: 10pt;line-height: 1.5">So, just ignore my over-cautious thoughts on this ifNil:-check on "view". Thinking too hard about "exploratory" and "liveness" and "reflection" and "long-running systems" can raise too many concerns... </span></div><div><br></div><div>Best,</div><div>Marcel</div><div class="mb_sig"></div>
                                        
                                        <blockquote class="history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
                        <p style="color: #AAAAAA; margin-top: 10px;">Am 10.07.2019 10:54:56 schrieb Levente Uzonyi <leves@caesar.elte.hu>:</p><div style="font-family:Arial,Helvetica,sans-serif">Hi Marcel,
<br>
<br>Thanks for the feedback.
<br>I checked the senders of #view: and didn't see the possibility of setting 
<br>it to nil. Based on the current usage, it could even be a "constructor" 
<br>parameter.
<br>
<br>I have the following senders in my image:
<br>- MorphicToolBuilder >> #buildPluggableText:
<br>      - the argument will be the result of a #new send
<br>- PBClassPreferenceView >> #textField
<br>      - the argument will be a PluggableTextMorphPlus
<br>- PluggableTextMorphPlus >> #useDefaultStyler
<br>      - the argument will be a PluggableTextMorphPlus
<br>
<br>By the way, what should the styler do with the styled text when view is 
<br>nil?
<br>
<br>Levente
<br>
<br>On Wed, 10 Jul 2019, Marcel Taeumel wrote:
<br>
<br>> Hi Levente,
<br>> nice! :-) For the background process, I would either closure "view" or check for nil because any do-it in the UI process might re-configure the styler. 
<br>> 
<br>> Best,
<br>> Marcel
<br>>
<br>>       Am 09.07.2019 23:00:45 schrieb commits@source.squeak.org <commits@source.squeak.org>:
<br>>
<br>>       Levente Uzonyi uploaded a new version of ShoutCore to project The Inbox:
<br>>       http://source.squeak.org/inbox/ShoutCore-ul.65.mcz
<br>>
<br>>       ==================== Summary ====================
<br>>
<br>>       Name: ShoutCore-ul.65
<br>>       Author: ul
<br>>       Time: 9 July 2019, 11:00:06.496443 pm
<br>>       UUID: 5b4b23fe-b7de-4498-a16b-80959cfb1e62
<br>>       Ancestors: ShoutCore-mt.64
<br>>
<br>>       Further SHTextStyler refactorings:
<br>>       - replaced text instance variable with temporiaries
<br>>       - removed monitor. backgroundProcess consistency is ensured by atomic execution of certain instructions
<br>>       - assume that view is never nil. It makes no sense to style when there's no view, and view is always assigned once, when a styler instance is created
<br>>
<br>>       =============== Diff against ShoutCore-mt.64 ===============
<br>>
<br>>       Item was changed:
<br>>       Object subclass: #SHTextStyler
<br>>       + instanceVariableNames: 'backgroundProcess view stylingEnabled'
<br>>       - instanceVariableNames: 'backgroundProcess text monitor view stylingEnabled'
<br>>       classVariableNames: ''
<br>>       poolDictionaries: ''
<br>>       category: 'ShoutCore-Styling'!
<br>>
<br>>       !SHTextStyler commentStamp: 'tween 8/27/2004 10:54' prior: 0!
<br>>       I am an Abstract class.
<br>>       Subclasses of me can create formatted, coloured, and styled copies of Text that is given to them.
<br>>       They may perform their styling asynchronously, in a background process which I create and manage.
<br>>
<br>>       My public interface is...
<br>>
<br>>       view: aViewOrMorph - set the view that will receive notifications when styling has completed.
<br>>
<br>>       format: aText - modifies aText's string
<br>>
<br>>       style: aText - modifies the TextAttributes of aText, but does not change the string, then sends #stylerStyled: to the view.
<br>>
<br>>       styleInBackgroundProcess: aText - performs style: in a background process, then sends #stylerStylednBackground: to the view.
<br>>
<br>>       styledTextFor: aText - answers a formatted and styled copy of aText
<br>>
<br>>       unstyledTextFrom: aText - answers a copy of aText with all TextAttributes removed
<br>>
<br>>       Subclasses of me should re-implement...
<br>>
<br>>       privateFormat: aText - answer a formatted version of aText; the String may be changed
<br>>       privateStyle: aText - modify the TextAttributes of aText; but do not change the String
<br>> 
<br>> 
<br>> 
<br>>
<br>>       !
<br>>
<br>>       Item was removed:
<br>>       - ----- Method: SHTextStyler>>monitor (in category 'private') -----
<br>>       - monitor
<br>>       - ^monitor ifNil: [monitor := Monitor new]!
<br>>
<br>>       Item was changed:
<br>>       ----- Method: SHTextStyler>>style: (in category 'styling') -----
<br>>       style: aText
<br>>       +
<br>>       + | text |
<br>>       self terminateBackgroundStylingProcess.
<br>>       + stylingEnabled ifFalse: [ ^self ].
<br>>       + text := aText copy.
<br>>       + self privateStyle: text.
<br>>       + view stylerStyled: text!
<br>>       - stylingEnabled ifTrue:[
<br>>       - text := aText copy.
<br>>       - self privateStyle: text.
<br>>       - view ifNotNil:[view stylerStyled: text] ]!
<br>>
<br>>       Item was changed:
<br>>       ----- Method: SHTextStyler>>styleInBackgroundProcess: (in category 'styling') -----
<br>>       styleInBackgroundProcess: aText
<br>>
<br>>       + | text newBackgroundProcess |
<br>>       self terminateBackgroundStylingProcess.
<br>>       + stylingEnabled ifFalse: [ ^self ].
<br>>       + text := aText copy.
<br>>       + newBackgroundProcess := [
<br>>       + self privateStyle: text.
<br>>       + Project current addDeferredUIMessage: [
<br>>       + view stylerStyledInBackground: text ].
<br>>       + Processor activeProcess == backgroundProcess ifTrue: [
<br>>       + backgroundProcess := nil ] ] newProcess
<br>>       + priority: Processor userBackgroundPriority;
<br>>       + yourself.
<br>>       + backgroundProcess ifNil: [
<br>>       + (backgroundProcess := newBackgroundProcess) resume ]!
<br>>       -
<br>>       - stylingEnabled ifTrue: [
<br>>       - text := aText copy.
<br>>       - self monitor critical: [
<br>>       - backgroundProcess := [
<br>>       - self privateStyle: text.
<br>>       - view ifNotNil: [:v | Project current addDeferredUIMessage: [v stylerStyledInBackground: text]].
<br>>       - ] forkAt: Processor userBackgroundPriority] ]
<br>>       - !
<br>>
<br>>       Item was changed:
<br>>       ----- Method: SHTextStyler>>terminateBackgroundStylingProcess (in category 'private') -----
<br>>       terminateBackgroundStylingProcess
<br>>       + "Terminate the background styling process if it exists. Assume that the first two lines are executed atomically."
<br>>
<br>>       + backgroundProcess ifNotNil: [ :backgroundProcessToTerminate |
<br>>       + backgroundProcess := nil.
<br>>       + backgroundProcessToTerminate terminate ]!
<br>>       - self monitor critical: [
<br>>       - backgroundProcess
<br>>       - ifNotNil: [
<br>>       - backgroundProcess terminate.
<br>>       - backgroundProcess := nil]].!
<br>>
<br>>       Item was changed:
<br>>       ----- Method: SHTextStyler>>veryDeepInner: (in category 'copying') -----
<br>>       veryDeepInner: aDeepCopier
<br>>       +
<br>>       super veryDeepInner: aDeepCopier.
<br>>       + backgroundProcess := nil.
<br>>       - backgroundProcess := monitor := nil.
<br>>       - text := text veryDeepCopyWith: aDeepCopier.
<br>>       view := view veryDeepCopyWith: aDeepCopier!
<br>> 
<br>> 
<br>> 
<br>><br></commits@source.squeak.org></div></blockquote></div>