Nautilus strange pattern

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

Nautilus strange pattern

stepharo
Hi

I'm trying to understand what there is a need for this window ifNil: [^
self ]
And I wonder is this is not  problem due to a global announcer that
would keep announcer even when the nautilus widget
has been deleted.
Any other suggestions?

Stef

classRemoved: anAnnouncement
     | class oldPackage |
     window ifNil: [ ^ self ].
     window isDisplayed
         ifFalse: [ ^ self ].
     class := anAnnouncement classRemoved.
     (self classWidget getClassesList includes: class)
         ifTrue:
             [

classRecategorized: anAnnouncement

     window ifNil: [ ^ self ].
     window isDisplayed ifFalse: [ ^ self ].
     self selectedPackage ifNotNil:[:selection |
     ({ anAnnouncement oldCategory. anAnnouncement newCategory }
         anySatisfy: [ :each | selection includesCategory: each ])
             ifTrue: [ self updatePackageGroupAndClassList ]]


classRemoved: anAnnouncement
     | class oldPackage |
     window ifNil: [ ^ self ].
     window isDisplayed
         ifFalse: [ ^ self ].
     class := anAnnouncement classRemoved.
     (self classWidget getClassesList includes: cla

Reply | Threaded
Open this post in threaded view
|

Re: Nautilus strange pattern

Nicolai Hess
We should make sure to unregister to all announcement when the window is closed.
(Or is there any reason or situation in which nautilus can properly work after the window is closed?)

2015-09-06 10:41 GMT+02:00 stepharo <[hidden email]>:
Hi

I'm trying to understand what there is a need for this window ifNil: [^ self ]
And I wonder is this is not  problem due to a global announcer that would keep announcer even when the nautilus widget
has been deleted.
Any other suggestions?

Stef

classRemoved: anAnnouncement
    | class oldPackage |
    window ifNil: [ ^ self ].
    window isDisplayed
        ifFalse: [ ^ self ].
    class := anAnnouncement classRemoved.
    (self classWidget getClassesList includes: class)
        ifTrue:
            [

classRecategorized: anAnnouncement

    window ifNil: [ ^ self ].
    window isDisplayed ifFalse: [ ^ self ].
    self selectedPackage ifNotNil:[:selection |
    ({ anAnnouncement oldCategory. anAnnouncement newCategory }
        anySatisfy: [ :each | selection includesCategory: each ])
            ifTrue: [ self updatePackageGroupAndClassList ]]


classRemoved: anAnnouncement
    | class oldPackage |
    window ifNil: [ ^ self ].
    window isDisplayed
        ifFalse: [ ^ self ].
    class := anAnnouncement classRemoved.
    (self classWidget getClassesList includes: cla


Reply | Threaded
Open this post in threaded view
|

Re: Nautilus strange pattern

Ben Coman
On Tue, Sep 8, 2015 at 5:32 AM, Nicolai Hess <[hidden email]> wrote:
> We should make sure to unregister to all announcement when the window is
> closed.

+1. Nautilus seems to leak announcements.  Sorry I forgot to log an
issue already for this...
https://www.mail-archive.com/pharo-dev@.../msg31953.html

So should I log a new issue now, or do you want to pick it up under
existing work?

cheers -ben

> (Or is there any reason or situation in which nautilus can properly work
> after the window is closed?)
>
> 2015-09-06 10:41 GMT+02:00 stepharo <[hidden email]>:
>>
>> Hi
>>
>> I'm trying to understand what there is a need for this window ifNil: [^
>> self ]
>> And I wonder is this is not  problem due to a global announcer that would
>> keep announcer even when the nautilus widget
>> has been deleted.
>> Any other suggestions?
>>
>> Stef
>>
>> classRemoved: anAnnouncement
>>     | class oldPackage |
>>     window ifNil: [ ^ self ].
>>     window isDisplayed
>>         ifFalse: [ ^ self ].
>>     class := anAnnouncement classRemoved.
>>     (self classWidget getClassesList includes: class)
>>         ifTrue:
>>             [
>>
>> classRecategorized: anAnnouncement
>>
>>     window ifNil: [ ^ self ].
>>     window isDisplayed ifFalse: [ ^ self ].
>>     self selectedPackage ifNotNil:[:selection |
>>     ({ anAnnouncement oldCategory. anAnnouncement newCategory }
>>         anySatisfy: [ :each | selection includesCategory: each ])
>>             ifTrue: [ self updatePackageGroupAndClassList ]]
>>
>>
>> classRemoved: anAnnouncement
>>     | class oldPackage |
>>     window ifNil: [ ^ self ].
>>     window isDisplayed
>>         ifFalse: [ ^ self ].
>>     class := anAnnouncement classRemoved.
>>     (self classWidget getClassesList includes: cla
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Nautilus strange pattern

Nicolai Hess
a new one.

2015-09-08 1:50 GMT+02:00 Ben Coman <[hidden email]>:
On Tue, Sep 8, 2015 at 5:32 AM, Nicolai Hess <[hidden email]> wrote:
> We should make sure to unregister to all announcement when the window is
> closed.

+1. Nautilus seems to leak announcements.  Sorry I forgot to log an
issue already for this...
https://www.mail-archive.com/pharo-dev@.../msg31953.html

So should I log a new issue now, or do you want to pick it up under
existing work?

cheers -ben

> (Or is there any reason or situation in which nautilus can properly work
> after the window is closed?)
>
> 2015-09-06 10:41 GMT+02:00 stepharo <[hidden email]>:
>>
>> Hi
>>
>> I'm trying to understand what there is a need for this window ifNil: [^
>> self ]
>> And I wonder is this is not  problem due to a global announcer that would
>> keep announcer even when the nautilus widget
>> has been deleted.
>> Any other suggestions?
>>
>> Stef
>>
>> classRemoved: anAnnouncement
>>     | class oldPackage |
>>     window ifNil: [ ^ self ].
>>     window isDisplayed
>>         ifFalse: [ ^ self ].
>>     class := anAnnouncement classRemoved.
>>     (self classWidget getClassesList includes: class)
>>         ifTrue:
>>             [
>>
>> classRecategorized: anAnnouncement
>>
>>     window ifNil: [ ^ self ].
>>     window isDisplayed ifFalse: [ ^ self ].
>>     self selectedPackage ifNotNil:[:selection |
>>     ({ anAnnouncement oldCategory. anAnnouncement newCategory }
>>         anySatisfy: [ :each | selection includesCategory: each ])
>>             ifTrue: [ self updatePackageGroupAndClassList ]]
>>
>>
>> classRemoved: anAnnouncement
>>     | class oldPackage |
>>     window ifNil: [ ^ self ].
>>     window isDisplayed
>>         ifFalse: [ ^ self ].
>>     class := anAnnouncement classRemoved.
>>     (self classWidget getClassesList includes: cla
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Nautilus strange pattern

stepharo
In reply to this post by Nicolai Hess


Le 7/9/15 23:32, Nicolai Hess a écrit :
We should make sure to unregister to all announcement when the window is closed.
(Or is there any reason or situation in which nautilus can properly work after the window is closed?)
Yes I was thinking about this too.
I took an image and removed all the

      window ifNil: [ ^ self ].
    window isDisplayed
        ifFalse: [ ^ self ].

and tried all kind of combination I could imagine.
It seemed to work but I should continue to experiment.

Stef

2015-09-06 10:41 GMT+02:00 stepharo <[hidden email]>:
Hi

I'm trying to understand what there is a need for this window ifNil: [^ self ]
And I wonder is this is not  problem due to a global announcer that would keep announcer even when the nautilus widget
has been deleted.
Any other suggestions?

Stef

classRemoved: anAnnouncement
    | class oldPackage |
    window ifNil: [ ^ self ].
    window isDisplayed
        ifFalse: [ ^ self ].
    class := anAnnouncement classRemoved.
    (self classWidget getClassesList includes: class)
        ifTrue:
            [

classRecategorized: anAnnouncement

    window ifNil: [ ^ self ].
    window isDisplayed ifFalse: [ ^ self ].
    self selectedPackage ifNotNil:[:selection |
    ({ anAnnouncement oldCategory. anAnnouncement newCategory }
        anySatisfy: [ :each | selection includesCategory: each ])
            ifTrue: [ self updatePackageGroupAndClassList ]]


classRemoved: anAnnouncement
    | class oldPackage |
    window ifNil: [ ^ self ].
    window isDisplayed
        ifFalse: [ ^ self ].
    class := anAnnouncement classRemoved.
    (self classWidget getClassesList includes: cla



Reply | Threaded
Open this post in threaded view
|

Re: Nautilus strange pattern

stepharo
In reply to this post by Ben Coman


Le 8/9/15 01:50, Ben Coman a écrit :
> On Tue, Sep 8, 2015 at 5:32 AM, Nicolai Hess <[hidden email]> wrote:
>> We should make sure to unregister to all announcement when the window is
>> closed.
> +1. Nautilus seems to leak announcements.  Sorry I forgot to log an
> issue already for this...
> https://www.mail-archive.com/pharo-dev@.../msg31953.html
>
> So should I log a new issue now,
sure
because we should go slowly with Nautilus.
I would like to get the state machine that all the if are trying to
rebuild in permanence.


> or do you want to pick it up under
> existing work?
>
> cheers -ben
>
>> (Or is there any reason or situation in which nautilus can properly work
>> after the window is closed?)
>>
>> 2015-09-06 10:41 GMT+02:00 stepharo <[hidden email]>:
>>> Hi
>>>
>>> I'm trying to understand what there is a need for this window ifNil: [^
>>> self ]
>>> And I wonder is this is not  problem due to a global announcer that would
>>> keep announcer even when the nautilus widget
>>> has been deleted.
>>> Any other suggestions?
>>>
>>> Stef
>>>
>>> classRemoved: anAnnouncement
>>>      | class oldPackage |
>>>      window ifNil: [ ^ self ].
>>>      window isDisplayed
>>>          ifFalse: [ ^ self ].
>>>      class := anAnnouncement classRemoved.
>>>      (self classWidget getClassesList includes: class)
>>>          ifTrue:
>>>              [
>>>
>>> classRecategorized: anAnnouncement
>>>
>>>      window ifNil: [ ^ self ].
>>>      window isDisplayed ifFalse: [ ^ self ].
>>>      self selectedPackage ifNotNil:[:selection |
>>>      ({ anAnnouncement oldCategory. anAnnouncement newCategory }
>>>          anySatisfy: [ :each | selection includesCategory: each ])
>>>              ifTrue: [ self updatePackageGroupAndClassList ]]
>>>
>>>
>>> classRemoved: anAnnouncement
>>>      | class oldPackage |
>>>      window ifNil: [ ^ self ].
>>>      window isDisplayed
>>>          ifFalse: [ ^ self ].
>>>      class := anAnnouncement classRemoved.
>>>      (self classWidget getClassesList includes: cla
>>>
>


Reply | Threaded
Open this post in threaded view
|

Re: Nautilus strange pattern

stepharo
In reply to this post by Ben Coman
just a question that came to my mind while reading your old mail.


">>>" SystemAnnouncer uniqueInstance unsubscribe: mod. "<<<added"

Are you sure that this is to this one that Nautilus is registered?

Today I discussed with esteban and we agreed that the GroupAnnouncer
should be just a class instance var of the Group class.
No need to have a subclass of Announcer + a singletong when we can use
an announcer.
Stef

Reply | Threaded
Open this post in threaded view
|

Re: Nautilus strange pattern

Ben Coman
On Wed, Sep 9, 2015 at 4:41 AM, stepharo <[hidden email]> wrote:
> just a question that came to my mind while reading your old mail.
>
>
> ">>>" SystemAnnouncer uniqueInstance unsubscribe: mod. "<<<added"
>
> Are you sure that this is to this one that Nautilus is registered?

I'm not sure if its the best approach, but apart from the steps to
reproduce in previous link,
you can do the following experiment. In a fresh image...

"(1)" SystemAnnouncer uniqueInstance inspect. "and review subscriptions tab"

"(2)" window := Smalltalk tools openClassBrowser ui window.
        SystemAnnouncer uniqueInstance inspect. "and review subscriptions tab"

"(3)" window delete.
        Smalltalk garbageCollect. Smalltalk garbageCollect. Smalltalk
garbageCollect.
        SystemAnnouncer uniqueInstance inspect. "and review subscriptions tab"

You will find leftover "a PackageTreeNautilusUI" subscriptions.  Now
repeat starting again with a fresh image, and after evaluating the
following...
    NautilusWindow compile: 'delete
       | mod |
       mod := self model.
       super delete.
       SystemAnnouncer uniqueInstance unsubscribe: mod.
       mod ifNotNil: [ mod announce: (WindowClosed new window: self) ] '

"a PackageTreeNautilusUI" is now correctly absent from the
SystemAnnouncer subscriptions.

A further experiment before and after ammending NautilusWindow>>delete is...
    20 timesRepeat: [
    window := Smalltalk tools openClassBrowser ui window.
    window delete.
    ].
    SystemAnnouncer uniqueInstance inspect.

I've now logged
https://pharo.fogbugz.com/default.asp?16525

cheers -ben