[ 
https://issues.apache.org/jira/browse/FLEX-27571?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15053815#comment-15053815
 ] 

Greg Dove commented on FLEX-27571:
----------------------------------

I encountered this also - but I don't think the correct fix is in ContentCache. 
I am also not sure if it is always 100% reproducible. It may even appear to 
occur 'randomly' depending on garbage collection timing, I certainly got it 
consistently around the time gc was running, which was at a 'consistent' point 
in usage of my app, around the time when I was making these requests and adding 
listeners to them (weak or non-weak did not make a difference here).
The workaround I use is to maintain a reference to the ContentRequest(s) until 
after you have handled all the possible final (event/outcome) states from the 
listeners you have attached to them, and then to remove the reference when you 
remove the listeners.

SDK developers/maintainers: I was also able to monkeypatch ContentRequest and 
remove the weak reference setting for the first two listeners inside its 
private addLoaderListeners method. This also worked for me in terms of 
correcting the issue described, and did not need me to maintain the local 
references to the ContentRequest(s), but I wasn't sure of the potential 
consequences, so I did not use the monkeypatch in our project, only using the 
workaround described above.

> Spark Image Content Cache does not dispatch a load complete event
> -----------------------------------------------------------------
>
>                 Key: FLEX-27571
>                 URL: https://issues.apache.org/jira/browse/FLEX-27571
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: .Unspecified - Framework
>    Affects Versions: Adobe Flex SDK 4.5.1 (Release)
>         Environment: Affected OS(s): Windows
> Affected OS(s): Windows
> Browser: Firefox 3.x
> Language Found: English
>            Reporter: Adobe JIRA
>
> Steps to reproduce:
> 1. Make a call to contentCache.load with a valid URL string.
> 2. Add a Event.COMPLETE listener to the returned content request from step 1.
> 3. The complete event listener is never invoked because the ContentCache 
> loader_completeHandler does not dispatch an event when the requested image is 
> loaded into the cache.
>  
>  Actual Results: No events are dispatched following a successful load 
> completion. 
>  
>  
>  Expected Results: The ContentRequest instance returned from the ContentCache 
> load() api should dispatch a "complete" event once an image is successfully 
> loaded.
>  
>  
>  Workaround (if any):
> Subclass ContentCache or create your own flavor of ContentCache and dispatch 
> a complete event in the loader_completeHandler()



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to