Query ctor must clone non-ref-counted PostingSource
In 1.2.x, we always attempted to clone the PostingSource object. This
clone code was removed as part of the changes in 1.3.5 to support
optional reference counting of PostingSource objects, but that breaks
the case when the PostingSource object is on the stack and goes out of
scope before the Query object is used.
To fix this, we now check if the PostingSource object is reference
counted and if not then attempt to clone it as happened in 1.3.4 and
earlier.
Issue reported by Till Schäfer and analysed by Daniel Vrátil in a
bug report against Akonadi: https://bugs.kde.org/show_bug.cgi?id=363741
(cherry picked from commit
cef6873ab3849875bf4c5d0147a4a07ba562bad9)