BUG: DolphinSplash zombies and other strange things

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

BUG: DolphinSplash zombies and other strange things

Keith Alcock
OA,

While trying to solve/avoid some other problems, I noticed some strange
things happening when Dolphin 4.0 ran on an old Win95 computer: there
was never any splash screen, the Help | About Dolphin Smalltalk menu
item was greyed, after the ADK ran a tip of the day would sometimes
mysteriously appear, DolphinSplash allInstances size answered 4 even
when there were none to see.

When Dolphin starts up, the DevelopmentSessionManager shows the splash
screen.

DevelopmentSessionManager>>showSplash
 "Show a splash screen for this session."

 | splashClass |
 (splashClass := self splashShellClass) isNil ifFalse: [
   (splashClass new)
   when: #viewClosed send: #tipOfTheDayAtStartup to: Smalltalk
developmentSystem;
   showTimed]

Later, DolphinSplash decides if the splash screen can really be
displayed.

DolphinSplash>>showTimed: aDelay
 "Shows the receiver and forks a process that will close it after
aDelay"

 self class canDisplay ifTrue: [
  Sound woofFor: #onStartup.
  super showTimed: aDelay ].

To do this, it checks the resolution.

DolphinSplash class>>canDisplay
 "Answer true if an instance of the receiver can be correctly displayed"

 "Displays of less than 800x600 resolution or with a palette cannot
correctly display the Dolphin
 splash bitmap."

 | desktopCanvas |
 desktopCanvas := View desktop canvas.
 ^desktopCanvas colorDepth>8 and: [desktopCanvas extent >= (800@600)].

If the splash screen can't be displayed, then splashDelay below is never
set.

Splash>>showTimed: aDelay
 "Shows the receiver and forks a process that will close it after
aDelay"

 SessionManager current when: #imageSaveStarting send: #onSaveImage to:
self.
 splashDelay := aDelay.

 super show.
 self beTopMost; update.
 [ splashDelay wait.
 super close ] fork.

This prevents the invisible splash window from ever closing.

Splash>>close
 "Closes the receiver by cancelling the Delay the splash is waiting on"

 splashDelay signal

So, there was no visible splash screen because of DolphinSplash
class>>canDisplay and the menu item was disabled for the same reason.
Somehow the ADK did get the invisible windows to exit and that seemed to
trigger the when: #viewClosed send: #tipOfTheDayAtStartup to: Smalltalk
developmentSystem.  Finally, each time I started up Dolphin and then
saved the image, an invisible DolphinSplash got saved.

To close the invisible windows, I added the code below and wished for a
superSuper pseudovariable.

DolphinSplash>>close

 splashDelay isNil ifTrue: [
  self sendMessage: WM_CLOSE wParam: 0 lParam: 0.
  ^self isOpen not.
 ].
 ^super close.
!

To get rid of the zombies, I evaluated

DolphinSplash allInstances do: [ :splash |
    splash close.
].

DolphiSplash allInstances do: [ :splash |
    splash become: String new.
].

To keep it from happening again, this method was changed:

DolphinSplash>>showTimed: aDelay
 "Shows the receiver and forks a process that will close it after
aDelay"

 self class canDisplay ifTrue: [
  Sound woofFor: #onStartup.
  super showTimed: aDelay.
 ] ifFalse: [
  self close.
 ].

There is probably a better solution, but something like this should
probably go into the next patch.

Keith Alcock