Revision 5632983...

Go back to digest for 9th December 2012

Optimization in KDE Base

Vishesh Handa committed changes in [nepomuk-core] /:

ResourceWatcher: Do no create a new ResourceManager on quit

The ResourceManager contains a ResourceWatcher. This ResourceWatcher is
initialized only when a Resource class requires it. On destruction it
calls ResourceWatcher::stop, which tries to disconnect it from
ResourceManager::nepomukSystemStarted signal.

The problem arises when the application is exiting, and the
ResourceManager (being a child of QCoreApplication) is being destroyed.
It in turn destroys the ResourceWatcher, which calls
ResourceWatcher::stop, which calls ResourceManager::instance() which
results in the creation of a new ResourceManager whose parent is
QCoreApplication::instance, which is 0, cause the application is
shutting down.

This whole extra ResourceManager being allocated is not required and can
be avoided by checking if QCoreApplication != 0, in

Also, since ResourceManager::instance() can now return 0. I've added an
assert check in the Resource class.

REVIEW: 107573

File Changes

Modified 3 files
  •   libnepomukcore/datamanagement/resourcewatcher.cpp
  •   libnepomukcore/resource/resource.cpp
  •   libnepomukcore/resource/resourcemanager.cpp
3 files changed in total