SeasideSt / Seaside

The framework for developing sophisticated web applications in Smalltalk.
MIT License
508 stars 71 forks source link

Squeak WAVNCController>>#renderContentOn: needs to test existence of a vnc server before asking if it is running #1395

Open timrowledge opened 7 months ago

timrowledge commented 7 months ago

The current version of WAVNCController>>#renderContentOn: crashed because the RFBServer class return nil if there is no running instance. A simple change to test for nil first solves this -

renderContentOn: html
    html heading: 'VNC Server'.
    self serverInstance
        ifNil: [self renderStartOn: html]
        ifNotNil:
            [self isServerRunning
                ifTrue: [ self renderStopOn: html ]
                ifFalse: [ self renderStartOn: html ]].
    html heading: 'UI Process'.
    self uiProcess isSuspended
        ifFalse: [ self renderSuspendOn: html ]
        ifTrue: [ self renderResumeOn: html ]

The RFBServer class also needs a small fix to provide an #isRunning method, but that is easy to solve and already committed in https://source.squeak.org/ss/RFB-tpr.23

marschall commented 1 week ago

Wouldn't it be better to do the nil check in #isServerRunning?

timrowledge commented 1 week ago

Yes, I do believe it would. Something like

isServerRunning
    ^ self serverInstance
        ifNil: [false]
        ifNotNil: [:srv| srv isRunning]

would probably be snesible. Or even 'sensible'.