Skip to content
Commit 71287984 authored by Vishesh Handa's avatar Vishesh Handa
Browse files

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
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment