Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

removePhaseListener() does NOT work

 
Mike Oliver
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a PhaseListener I want to conditionally add to a Lifecycle. When the conditions are right, it successfully uses lifecycle.addPhaseListner(myConditionalListener) and it processes just fine. At the end of that cycle I want to remove that phaseListener with lifecycle.removePhaseListener(myConditionalListener) The code runs but the listener remains until I restart the application.

I have tried both

currentLifecycle.removePhaseListener(cpl);
context.getViewRoot().removePhaseListener(cpl);

With no effect.

Since this listner is costly in terms of performance and only needed in a particular set of conditions, I wanted to use removePhaseListener and I have several such conditional listeners. I would prefer if this works or if I need to do something else in addition to this or instead of this, but I can always have a customeListener that did the logic and was always in there and had its own factory but that's a kludge since removePhaseListener is there it should work, yes?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!