You're probably wrong.  Anything registered with callLater is kept alive by its 
registration.  The call stack indicates that code in your class at line 490 is 
using anull reference.  That could be because you cleaned up something before 
callLater came through.  A simple null check there should solve the problem

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
christian.menzinger
Sent: Tuesday, November 04, 2008 8:39 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] callLater calls from framework / validation after 
instances are already removed


Hi all,

I have a very special problem:

By selecting an item in my navigation I start rendering my view with several 
display objects (container, components, ...).

Every time I select an other item, I remove all stuff from display list 
(destroying all bindings, remove all listeners, setting everything to null).

If I do very quick changes, after a while I receive null-pointer exceptions in 
different classes in different validation methods (measure / updateDisplayList) 
like

TypeError: Error #1009: Cannot access a property or method of a null object 
reference.
    at package::ClassName/updateDisplayList()[ClassName.as:490]
    at 
mx.core::UIComponent/validateDisplayList()[framework\src\mx\core\UIComponent.as:6293]
    at 
mx.managers::LayoutManager/validateDisplayList()[framework\src\mx\managers\LayoutManager.as:605]
    at 
mx.managers::LayoutManager/doPhasedInstantiation()[framework\src\mx\managers\LayoutManager.as:660]
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at 
mx.core::UIComponent/callLaterDispatcher2()[framework\src\mx\core\UIComponent.as:8565]
    at 
mx.core::UIComponent/callLaterDispatcher()[framework\src\mx\core\UIComponent.as:8508]

The exception stack trace starts always by callLaterDispatcher like above.

I think the null-pointer happen because the render engine applies a call later 
for rendering in the next frame, unfortunately I removed the instanced in time 
between and so all my component children are null.

That brings me to the following questions:
- Could it be true that fl! ex forces validation via callLater even if the 
instance is rem! oved? Ho w could this be?
- If so, how can I solve the problem proper (e.g. remove all callLaters in my 
destroy functions -> btw: there is a mx_internal function cancelAllCallLaters() 
in UIComponent but that is not working for me -> no effect if I call this 
function in my destroy functions)
- Or am I completely wrong and the problem is part of my custom components 
development?

If you have any ideas or solutions which can guide me in the right direction 
would be very cool.

Thanks a lot
Chris

Reply via email to