Race condition of display objects added to stage but not to storyboard view

I am having a problem that is hard to reproduce but occurs enough where it might be a problem for others as well. I am noticing that occasionally there will be a race condition where an object will be added to the global display stage but not make it into a display group. Here is an example

function scene:createScene( event )  
 local group = self.view  
  
 -- image is added to stage  
 local image = display.newImageRect("assets/image.png",100,100)  
  
 -- something screwy happens in here before image inserted to storyboard view  
  
 -- following line never executes   
 group:insert(image)  
  
end  

That is a way over simplified example because it usually happens in callbacks or possibly due to slowdowns caused by asynchronus network connections that have dependent functions that display things (ie live data).

The result is that objects are left floating above the storyboard view display group and are not removed when there is a scene transition. The only fix would be for the user to kill the app entirely and start over.

Has anybody experienced this? Does anyone have a good function to traverse the stage and remove any remnant display objects that didn’t make it into the storyboard’s view group? I have tried but I have seemed to cause erratic storyboard behavior. Probably b/c I don’t understand exactly what is happening in the storyboard execution chain. [import]uid: 2787 topic_id: 26204 reply_id: 326204[/import]