Fix ItemRetriever in case of concurrent requests for the same item(s)

Authored by dfaure on Feb 15 2017, 7:43 AM.

Description

Fix ItemRetriever in case of concurrent requests for the same item(s)

Summary:

  • ItemRetrievalManager must emit requestFinished() for those other requests,

otherwise the list of pending requests in ItemRetriever is never emptied

  • ItemRetriever must not assume that a signal being emitted by

ItemRetrievalManager is necessarily about the request it's waiting for, it
could be for another one. So it must first check in its list of pending
requests to determine whether it should react or not.

With multithreaded unittest, checked for races with clang+tsan.
(There is one race, the connect to ItemRetrievalRequest vs the emit
in other threads, we should lock mLock before connect...)

Test Plan: new unittest

Reviewers: dvratil

Reviewed By: dvratil

Subscribers: KDE PIM

Tags: KDE PIM

Differential Revision: https://phabricator.kde.org/D4618