Skip navigation
Conanicut
Currently Being Moderated

suggested workaround for list itemrenderer bug?

May 19, 2012 12:01 PM

Tags: #problem #error #list #itemrenderer #flex4.5

Can someone point me in the right direction for a workaround for the problem described as Flex bug 28191:

 

***

https://bugs.adobe.com/jira/browse/SDK-28191

 

Steps to reproduce:

 

1. Populate a Tree/List with data and provide a custom itemRenderer class factory.

 

2. Change the class factory and dataProvider at the same time.

 

3. List.createItemRenderer() will crash during since Factory is the key and it has been changed.

                delete freeItemRenderersByFactory[factory][renderer];

 

Actual Results:

Crash because the renderer can not be found since it does not exist on that factory dictionary since the class factory was changed and the lookup is using the new factory.

 

Expected Results:

Not crash.

 

Seems like a race condition, as sometimes during this process it skips that block of code but in other cases it falls into this block and fails.

 

***

I need to change the data provider and item renderer of a tree control at runtime. Is there one or more methods I should run to prevent this? As the bug notes state, this is an intermittent problem. The error occurs here:

 

if (factory == itemRenderer)

        {

            if (freeItemRenderers && freeItemRenderers.length)

            {

                renderer = freeItemRenderers.pop();

                delete freeItemRenderersByFactory[factory][renderer];

            }

        }

 

 
Replies
  • Currently Being Moderated
    May 19, 2012 9:19 PM   in reply to Conanicut

    How are you changing the classFactory?  Try calling validateNow() after changing it and before you set the dataprovider.

     
    |
    Mark as:
  • Currently Being Moderated
    May 20, 2012 10:32 PM   in reply to Conanicut

    Changing just the renderer, then calling validateNow() should set a flag that flushes the freeItemRenderers.  It is possible that if something else is dirty (new data for example) then other code might run before the renderers get flushed.

     

    There is a protected method called purgeItemRenderers() that actually does the flushing.  I supposed you could try subclassing and calling it directly.

     

    -Alex

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 22, 2012 8:10 PM   in reply to Flex harUI

    That is also my problem....

     

    When I try to delete a row with itemrenderer from the datagrid, the row will be deleted. But when I try to add again a row, the property of last item renderer will not be flushed or deleted.

     

    How to remove item renderers?

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points