[Nepomuk] Review Request: Slightly hacky fix for bug 292996 (crash in Nepomuk2::~Resource).

Simeon Bird bladud at gmail.com
Tue Dec 4 04:41:26 UTC 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/107572/
-----------------------------------------------------------

Review request for Nepomuk, Vishesh Handa and Sebastian Trueg.


Description
-------

Slightly hacky fix for bug 292996 (crash in Nepomuk2::~Resource).

The problem is that kontact has a class, NepomukResourceRetrieverRunnable,
which inherits from QRunnable, and creates a Resource on the stack of it's QThread.

But, unknown to it, it is actually getting a reference to a Resource
stored by the ResourceManager, which has QApplication as a parent.

When kontact exists, it deletes ResourceManager.

But at this point the QRunnable has not yet been stopped,
because the caller assumes that they have allocated
Nepomuk::Resource on the QThread stack, and are not aware
that it is secretly shared with the other threads via
the singleton class in ResourceManager.

The QRunnable persists, but now resources don't point to anything.

The Q_ASSERTs in the destructor were not firing, I think, because only in a
release build was the destruction of QApplication fast enough to outrun
the QRunnables.

The fix is just to have the ResourceManager destructor check the
ref-count for all its resources in a loop and not go away until
they are all zero.

BUG: 292996
FIXED-IN: 4.10


This addresses bug 292996.
    http://bugs.kde.org/show_bug.cgi?id=292996


Diffs
-----

  libnepomukcore/resource/resourcemanager.cpp 457c042cef160660a6d2eb9b6695863bd75fdb86 

Diff: http://git.reviewboard.kde.org/r/107572/diff/


Testing
-------

Compiled. Can't reproduce bug, so can't check it fixes it.


Thanks,

Simeon Bird

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/nepomuk/attachments/20121204/28b6f33d/attachment.html>


More information about the Nepomuk mailing list