[squeak-dev] unload method not called by Monticello

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

[squeak-dev] unload method not called by Monticello

Miguel Cobá
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á


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] unload method not called by Monticello

Bert Freudenberg
On 07.08.2009, at 05:48, Miguel Enrique Cobá Martinez wrote:

> 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)?


There used to be a bug in Monticello that first removed all the  
methods in a class and then removed the class itself, which would look  
for the unload method but find none since it had been removed. The fix  
was to not remove any methods if the whole class is removed anyways.  
But I can't remember where that fix went ...

- Bert -



Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] unload method not called by Monticello

Miguel Cobá
El vie, 07-08-2009 a las 11:22 +0200, Bert Freudenberg escribió:

> On 07.08.2009, at 05:48, Miguel Enrique Cobá Martinez wrote:
>
> > 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)?
>
>
> There used to be a bug in Monticello that first removed all the  
> methods in a class and then removed the class itself, which would look  
> for the unload method but find none since it had been removed. The fix  
> was to not remove any methods if the whole class is removed anyways.  
> But I can't remember where that fix went ...
>
> - Bert -
>

Oh, thanks Bert. I will search the mailing lists more carefully.

Miguel Cobá
>
>