FlexXMLApplicationContext.dispose() disposes too much?
Hi list,
I have some problems using the dispose() method of the FlexXMLApplicationContext.
My scenario is:
I have a master-context with global services. If I load a module, the module has it's own module-context and the master-context is set as parent. So I the global services are available in the module.
Before I unload the module I call the dispose() method so the module can be garbage-collected after unloading. After that the next module can be loaded.
This works fine BUT I can't use services from the master-context in my master application after calling the dispose() method.
Example:
My master application opens a popUp which contains a presentationModel which uses the demoService (is a global service). Opening the popUp runs well.
I load a module in which has an own module-context, the master-context is merged in and I can use the demoService. This runs well.
I load another module which means I unload the loaded module and call the dispatch() method.
After calling the dispatch() method the demoService is no more available in the popUp.
If I reload the module using the demoService the demo data is shown.
Is there any solution my usecase works? Maybe I'm able to provide the complete demo application.
Regards,
Christoph