ResourceManager: Cleanup out all the existing Resources before exit
Ideally, there should be no ResourceData* in the cache when the ResourceManager is being destroyed. However, they can be cases when a Resource has been allocated statically and it is destroyed after the ResourceManager. In that case, when the Resource is eventually destroyed, it will crash as it will try to access the deleted ResourceManager. In order to fix this, we connect to QCoreApplication::aboutToQuit signal and set all the Resource::m_data = 0. This results in the Resource class not doing anything during its destruction and therefore not crashing. We also delete all the ResourceData pointers. This cleanUpResource() cannot be done in the ResourceManager destructor cause ResourceData::resetAll accesses NIE::url() and NAO::identifier(), both of which are also static variables and could have been destroyed before. BUG: 292996 FIXED-IN: 4.10 REVIEW: 107575
parent
ff709a4b
Please register or sign in to comment