[squeak-dev] unload method not called by Monticello

Miguel Enrique Cobá Martinez miguel.coba at gmail.com
Fri Aug 7 03:48:01 UTC 2009


Take a clean sq3.10.2-7179web09.03.1.image.

World Menu -> Universe browser (basic)

Select category Network. Install RFB-VNC version 1.2.

Start the vnc server

World Menu -> RFB/VNC Server -> start server

display 0

Accept.

The server is now running and a RFBDisplayScreen is installed instead of
the normal Display. An RFBEventSensor is installed instead of the normal
InputEventSensor.

If you stop the RFB server, the original Display and Sensor are
restored.
Until here everything ok.

The RFBServer has an unload method, that is, as I understand, called on
class unload from the image. The problem is that is not called.

Check this:

RFBServer class >> unload
	"RFBServer is being removed from the image."

	self stop; unregisterInOpenMenu


RFBServer class >> stop
	"RFBServer stop"

	Server isNil
		ifTrue:
			[self log: 'server not running?']
		ifFalse:
			[Server := Server stop.
			 Smalltalk
				removeFromStartUpList: self;
				removeFromShutDownList: self].
	^nil

Server is a class variable with an instance of RFBServer.

RFBServer >> stop
	"Stop the RFB server, closing all open viewer connections."

	process ifNotNil: [ process terminate ].
	socket closeAndDestroy.
	self log: 'stopped'.
	self terminateSessions.
	self release.
	^nil

RFBServer >> release
	"Release resources associated with the server.  This method is mainly
to ensure that the runLoop process doesn't try to touch any of the
following again..."

	self removeDisplay.
	sessions := nil.
	sessionsSema := nil.
	process := nil.
	self log: 'released'

and finally:

RFBServer >> removeDisplay
	"The RFB server is shutting down.  Remove our fake Display and Sensor,
replacing them with the originals."

	((Display isMemberOf: RFBDisplayScreen) and: [Sensor isMemberOf:
RFBEventSensor])
		ifFalse: [^self].
	(Display := DisplayScreen new copyFrom: Display) beDisplay.
	Sensor become: (Sensor copyTo: EventSensor new).
	self log: 'RFBDisplayScreen. RFBEventSensor removed'

Well, several methods. The point is, the unload method, through several
calls, reaches removeDisplay that restores the Display and Sensor
classes to their original non-RFB ones.

If you start the server, then stop it and finally with monticello you
unload the RFB package, everything is ok, because when you stop the
server the releaseDisplay is called correctly.

But, if you start the server, you don't stop it and you remove it with
monticello, the unload method is not called and the releaseDisplay
neither. So, Display and Sensor are the RFB-installed ones. As you are
unloading the RFB package with monticello, the package is unloaded and
you end with AnObsoleteRFBDisplayScreen for Display and
AnObsoleteRFBEventSensor for Sensor.

Someone has an idea about what is happening and why the unload method
isn't being called (I even put a self halt in it but it never got
called)?

Thanks,
Miguel Cobá




More information about the Squeak-dev mailing list