[Nepomuk] Review Request: ResourceWatcher: Do no create a new ResourceManager on quit
Vishesh Handa
me at vhanda.in
Thu Dec 6 08:40:32 UTC 2012
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/107573/
-----------------------------------------------------------
(Updated Dec. 6, 2012, 8:40 a.m.)
Review request for Nepomuk, Sebastian Trueg and Simeon Bird.
Changes
-------
Return an empty resource in release builds.
Description
-------
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
ResourceManager::instance.
Also, since ResourceManager::instance() can now return 0. I've added an
assert check in the Resource class.
Diffs (updated)
-----
libnepomukcore/datamanagement/resourcewatcher.cpp a09b646
libnepomukcore/resource/resource.cpp 4601eba
libnepomukcore/resource/resourcemanager.cpp 457c042
Diff: http://git.reviewboard.kde.org/r/107573/diff/
Testing
-------
Added breakpoints in gdb, and wrote a simple application. The extra ResourceManager is no longer being created.
Thanks,
Vishesh Handa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/nepomuk/attachments/20121206/ac26ba78/attachment-0001.html>
More information about the Nepomuk
mailing list