Iliad in Pharo 1.3

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

Re: Iliad in Pharo 1.3

Bernat Romagosa
Nope, same problem :'(

I think I'm getting a grasp of its nature though. Here's the thing:

The application has plenty of widgets, and some of them are interdependent, so using #addDependantWidget: would result in crossed-references and infinite loops, which is why I'm using announcements to decouple widgets. 

My announcer is held by a custom session class, and when a widget needs another widget to perform some task, it fires a new announcement that is caught by the second widget.

The problem happens when the announcement is captured, specifically when the receiving widget tries to mark itself dirty.

My guess is that, on initialization, the widget knows who its context is, but when the announcement is caught, self context is not the widget's context anymore, so:

MyWidget >> initialize
(...)
self session announcer
   on: SomeAnnouncement
   do: [:ann |
       self doWhateverYouHaveToDo.
       self markDirty ] " ← self markDirty eventually resolves to self context, which is nil "

Should I set up an example that triggers this problem with the ILCounter so you can debug it in your machine?

Cheers,

2011/7/8 Bernat Romagosa <[hidden email]>
Hi Nico,

Your test is working for me too, I'm going to try to install my application in this Pharo build and see what happens...

Thanks!

Bernat.


2011/7/6 Nicolas Petton <[hidden email]>
Hi guys,

Bernat, after running some tests, I couldn't find the issue. Calling
"self session" on widget initialization works fine with me. This is how
I tested it:

- start a fresh Pharo1.3 image
- load the latest dev packages of Iliad
- change ILCounter>>initialize to:

initialize
       super initialize.
       self session inspect

works fine for me.

does the modified ILCounter>>initialize method work for you?

Cheers,
Nico

Le vendredi 01 juillet 2011 à 18:30 +0200, Nicolas Petton a écrit :
> Le vendredi 01 juillet 2011 à 16:45 +0200, Stefan Schmiedl a écrit :
> > On Fri, 1 Jul 2011 15:22:01 +0200
> > Stefan Schmiedl <[hidden email]> wrote:
> >
> > > 'From Pharo1.2.1 of 29 March 2011 [Latest update: #12345] on 1 July 2011 at 2:59:04 pm'!
> > >
> > > !ILWidgetMock1 methodsFor: 'as yet unclassified' stamp: 'StefanSchmiedl 7/1/2011 14:57'!
> > > initialize
> > >   super initialize.
> > >   self session announcer on: Announcement do: [:it | it inspect ]! !
> > >
> > >
> > > The good news is that the behavior is consistent over recent Pharo and Iliad releases,
> > > the bad news is that your approach does not seem to work in either one.
> >
> > Assuming that the tests are mirroring real use cases, this actually
> > makes sense:
> >
> > ILWidgetTest>>setUp causes ILWidgetMock1>>initialize to be called
> > before the wrapper ILWidgetTest>>withSessionDo: has a chance to
> > plug a session-carrying context into ILCurrentContext.
> >
> > If I understand this correctly (and I might as well be wrong), you
> > just don't have a session during widget creation, but only in the
> > building phase.
> >
> > Heh ... maybe that's the other, long forgotten reason why I didn't put
> > my announcer into session :-)
>
> I'll add a unit test for that and a fix if needed. Downloading pharo 1.3
> right now...
>
>
> Cheers,
> Nico
> >
> > s.
>

--
Nicolas Petton
http://www.nicolas-petton.fr




--
Bernat Romagosa.



--
Bernat Romagosa.
Reply | Threaded
Open this post in threaded view
|

Re: Iliad in Pharo 1.3

Bernat Romagosa
Hi,

Here's a little test that triggers the problem, just click on "Test me" in the counter widget example, this will launch an announcement that's gonna be intercepted by the counter widget and fire a debugger. Notice that it happens when trying to markDirty the counter widget.

We're closing in! :)

Cheers,

2011/7/8 Bernat Romagosa <[hidden email]>
Nope, same problem :'(

I think I'm getting a grasp of its nature though. Here's the thing:

The application has plenty of widgets, and some of them are interdependent, so using #addDependantWidget: would result in crossed-references and infinite loops, which is why I'm using announcements to decouple widgets. 

My announcer is held by a custom session class, and when a widget needs another widget to perform some task, it fires a new announcement that is caught by the second widget.

The problem happens when the announcement is captured, specifically when the receiving widget tries to mark itself dirty.

My guess is that, on initialization, the widget knows who its context is, but when the announcement is caught, self context is not the widget's context anymore, so:

MyWidget >> initialize
(...)
self session announcer
   on: SomeAnnouncement
   do: [:ann |
       self doWhateverYouHaveToDo.
       self markDirty ] " ← self markDirty eventually resolves to self context, which is nil "

Should I set up an example that triggers this problem with the ILCounter so you can debug it in your machine?

Cheers,

2011/7/8 Bernat Romagosa <[hidden email]>
Hi Nico,

Your test is working for me too, I'm going to try to install my application in this Pharo build and see what happens...

Thanks!

Bernat.


2011/7/6 Nicolas Petton <[hidden email]>
Hi guys,

Bernat, after running some tests, I couldn't find the issue. Calling
"self session" on widget initialization works fine with me. This is how
I tested it:

- start a fresh Pharo1.3 image
- load the latest dev packages of Iliad
- change ILCounter>>initialize to:

initialize
       super initialize.
       self session inspect

works fine for me.

does the modified ILCounter>>initialize method work for you?

Cheers,
Nico

Le vendredi 01 juillet 2011 à 18:30 +0200, Nicolas Petton a écrit :
> Le vendredi 01 juillet 2011 à 16:45 +0200, Stefan Schmiedl a écrit :
> > On Fri, 1 Jul 2011 15:22:01 +0200
> > Stefan Schmiedl <[hidden email]> wrote:
> >
> > > 'From Pharo1.2.1 of 29 March 2011 [Latest update: #12345] on 1 July 2011 at 2:59:04 pm'!
> > >
> > > !ILWidgetMock1 methodsFor: 'as yet unclassified' stamp: 'StefanSchmiedl 7/1/2011 14:57'!
> > > initialize
> > >   super initialize.
> > >   self session announcer on: Announcement do: [:it | it inspect ]! !
> > >
> > >
> > > The good news is that the behavior is consistent over recent Pharo and Iliad releases,
> > > the bad news is that your approach does not seem to work in either one.
> >
> > Assuming that the tests are mirroring real use cases, this actually
> > makes sense:
> >
> > ILWidgetTest>>setUp causes ILWidgetMock1>>initialize to be called
> > before the wrapper ILWidgetTest>>withSessionDo: has a chance to
> > plug a session-carrying context into ILCurrentContext.
> >
> > If I understand this correctly (and I might as well be wrong), you
> > just don't have a session during widget creation, but only in the
> > building phase.
> >
> > Heh ... maybe that's the other, long forgotten reason why I didn't put
> > my announcer into session :-)
>
> I'll add a unit test for that and a fix if needed. Downloading pharo 1.3
> right now...
>
>
> Cheers,
> Nico
> >
> > s.
>

--
Nicolas Petton
http://www.nicolas-petton.fr




--
Bernat Romagosa.



--
Bernat Romagosa.



--
Bernat Romagosa.

ILIssueTestWidget.zip (5K) Download Attachment
12