[Pharo-project] About NonInteractiveUIManager>>#onSnapshot: and related

Guillermo Polito guillermopolito at gmail.com
Tue Mar 20 22:35:36 EDT 2012


I was doing some hacking, and playing with NonInteractiveUIManager.  And it
puzzled me that I realized that it has an inst var *uiManager* that seems
to refer to an uiManager it's replacing.
But my UIManager is not replacing anyone, it's my default and unique
UIManager and this var points to nil :S!

So the code below does not work...

onSnapshot: resuming
    "The resuming argument is true when image boots from disk,
    and false, if user just did an image snapshot."

    resuming ifTrue: [
        Smalltalk isHeadless ifFalse: [
            "restore old, or nil, so it will be set in #default "
                *uiManager beDefault.
                UIManager default onSnapshot: resuming.*
            ^ self ].
        Smalltalk isInteractive ifTrue: [
            "use a headless but interactive manager"
            ^ self headlessManager onSnapshot: resuming ]].

    " this flag set to true only if we are saving a snapshot before
quitting "
    doNotQuitOnRestart ifTrue: [
        Smalltalk snapshot: false andQuit: true].

I made it work in my image adding within the controversial lines:

uiManager ifNotNil: [
*    uiManager beDefault.
    UIManager default onSnapshot: resuming.*

But it really looks like a hack because that inst var is ment to do
something else...
Is it asking me for a refactor?  Or am I using this stuff in the wrong
way?  Camillo, Igor? :P

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20120320/e7383232/attachment-0001.html>

More information about the Pharo-dev mailing list