Scott,
There seems to be a variety of cirumstances where the behavior can be
seen. Here's a bug entry for the item already:
http://bugs.adobe.com/jira/browse/SDK-14470
I was able to make it happen by have a PopUpButton instance inside a
Panel inside a Module.
This defintely must be resolved before Flex 3 is released. Can't have
something as generic as a PopUpButton failing and requiring a
workaround. Yes it is true that there were other issues with the
PopUpButotn component, however right now this component is effectively
broken and I would hope it doesn't assume the category of a 'known
issue' when Flex 3 is formally released.
Jeff
-----Original Message-----
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Scott Melby
Sent: Wednesday, February 06, 2008 8:39 AM
To: [email protected]
Subject: Re: [flexcoders] Re: PopUpButton issue
I have now :) http://bugs.adobe.com/jira/browse/SDK-14562
Scott
Scott Melby
Founder, Fast Lane Software LLC
http://www.fastlanesw.com
dazweeja wrote:
I agree - nulling the _popUp property seems like a hack.
There doesn't seem to be a
logical link between removing a PopUpButton from the
stage and nulling its _popUp
property. Why would a developer expect to have to re-set
the _popUp property of a
previously functioning PopUpButton every time its added
back to the stage? If there's code
elsewhere that requires this hack then it sounds like
that code that should be fixed.
Covering it up only leads to more problems later on.
Scott, have you filed a bug for this?
--- In [email protected]
<mailto:flexcoders%40yahoogroups.com> , "vdeprojects" <[EMAIL PROTECTED]>
<mailto:[EMAIL PROTECTED]> wrote:
>
> I'm having exactly the same problem - it's as if the
PopupButton is
> suffering from Alzheimer. Scotts solution works great
and I also
> think that not resetting the _popUp variable to null
would be much
> better. If you don't think so it would be nice if you
could make the
> method protected so we can fix it ourselves :)
>
> Regarding memory leaks: wouldn't it be better if these
event handlers
> (removed_from_stage, added_to_stage, ...) were using
weak
> references???
>
> --- In [email protected]
<mailto:flexcoders%40yahoogroups.com> , "Deepa Subramaniam" <dsubrama@>
> wrote:
> >
> > There were intricacies with the PopUpManager logic
which, I think,
> led
> > to this solution. The framework changelist
(available on labs) would
> > have more details.
> >
> >
> >
> > ________________________________
> >
> > From: [email protected]
<mailto:flexcoders%40yahoogroups.com>
> [mailto:[email protected]
<mailto:flexcoders%40yahoogroups.com> ] On
> > Behalf Of Scott Melby
> > Sent: Wednesday, January 16, 2008 12:47 PM
> > To: [email protected]
<mailto:flexcoders%40yahoogroups.com>
> > Subject: Re: [flexcoders] PopUpButton issue
> >
> >
> >
> > Deepa -
> >
> > Thanks! It seems you could avoid the memory leak
without nulling
> _popUp
> > couldn't you? i.e. just call
PopUpManager.removePopUp(_popUp)
> without
> > the following line that nulls the reference. Is that
not right?
> >
> > Scott
> >
> >
> >
> > Scott Melby
> > Founder, Fast Lane Software LLC
> > http://www.fastlanesw.com
<http://www.fastlanesw.com>
> >
> >
> >
> > Deepa Subramaniam wrote:
> >
> > This chunk of code was added on purpose, to avoid
problematic memory
> > leaks with popup components. In Jira you can see it
was fixed to
> address
> > SDK bug 13104. We were not correctly unregistering
popup children
> when
> > necessary. Your workaround is correct, so feel safe
using it :)
> >
> > https://bugs.adobe.com/jira/browse/SDK-13104
<https://bugs.adobe.com/jira/browse/SDK-13104>
> > <https://bugs.adobe.com/jira/browse/SDK-13104
<https://bugs.adobe.com/jira/browse/SDK-13104> >
> >
> > -----Original Message-----
> > From: [email protected]
<mailto:flexcoders%40yahoogroups.com> <mailto:flexcoders%
> 40yahoogroups.com>
> > [mailto:[email protected]
<mailto:flexcoders%40yahoogroups.com> <mailto:flexcoders%
> 40yahoogroups.com>
> > ] On
> > Behalf Of Scott Melby
> > Sent: Wednesday, January 16, 2008 5:38 AM
> > To: [email protected]
<mailto:flexcoders%40yahoogroups.com> <mailto:flexcoders%
> 40yahoogroups.com>
> > Subject: [flexcoders] PopUpButton issue
> >
> > I have a PopUpButton on which I am setting a Menu as
the popUp
> > property. I have found that the popUp attribute is
being nulled
> when
> > the PopUpButton is removed from the stage... which
causes my button
> to
> > not function properly when added back to the stage.
I traced the
> issue
> > to the following code in PopUpButton.as which
appears to be
> incorrect.
> > In this code the _popUp member (backing for the
popUp setters and
> > getters) is nulled.
> >
> > private function
removedFromStageHandler(event:Event):void
> > {
> > // Ensure we've unregistered ourselves from
PopupManager, else
> > // we'll be leaked.
> > if (_popUp) {
> > PopUpManager.removePopUp(_popUp);
> > _popUp = null;
> > }
> > }
> >
> > To workaround this issue I had to listen for the
addedToStage event
> in
> > my view that uses this component and re-set the
popUp property each
> time
> >
> > as follows.
> >
> > /**
> > * Called each time this view is added to the stage.
We
> > need this to work
> > * around an issue where the PopUpButton has a null
popUp
> > * property each time it has been removed from the
stage.
> > */
> > public function handleAddedToStage():void{
> > if(this.createButton != null && this._buttonMenu !=
> > null){
> > this.createButton.popUp = _buttonMenu;
> > }
> > }
> >
> > Has anybody else seen this? Can somebody please let
me know if this
> is
> > a bug in the toolkit? The workaround works fine...
but seems like
> it
> > should not be necessary.
> >
> > Thanks
> > Scott
> >
> > --
> > Scott Melby
> > Founder, Fast Lane Software LLC
> > http://www.fastlanesw.com
<http://www.fastlanesw.com> <http://www.fastlanesw.com
<http://www.fastlanesw.com> >
> >
> > --
> > Flexcoders Mailing List
> > FAQ:
>
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
<http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt>
> >
<http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
<http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt> >
> > Search Archives:
> >
http://www.mail-archive.com/flexcoders%40yahoogroups.com
<http://www.mail-archive.com/flexcoders%40yahoogroups.com>
> >
<http://www.mail-archive.com/flexcoders%40yahoogroups.com
<http://www.mail-archive.com/flexcoders%40yahoogroups.com> >
> > Yahoo! Groups Links
> >
>