Skip to content
Snippets Groups Projects
Commit c7695063 authored by Guillaume Roguez's avatar Guillaume Roguez Committed by Nicolas Jager
Browse files

media/text: fix invalid reference

VCardUtils::parseMimeAttributes() returns by value, but
it was used in IMConversationManagerPrivate::newMessage() by reference.
So this reference is on a stack-allocated object and can be invalidated
by the system.

Use a by-value copy, mostly optimized by compiler with copy elision [1].

[1] http://en.cppreference.com/w/cpp/language/copy_elision



Change-Id: I1b7ef8eb1ebc738949243d5ace1363d4b4fa3caf
Reviewed-by: default avatarNicolas Jäger <nicolas.jager@savoirfairelinux.com>
parent 4b010cbc
No related branches found
No related tags found
No related merge requests found
......@@ -155,7 +155,7 @@ void IMConversationManagerPrivate::newMessage(const QString& callId, const QStri
iter.next();
if (iter.key().left(profileSize) == RingMimes::PROFILE_VCF) {
const auto& args = VCardUtils::parseMimeAttributes(iter.key());
auto args = VCardUtils::parseMimeAttributes(iter.key());
if (auto person = ProfileChunk::addChunk(args, iter.value(), call->peerContactMethod())) {
PersonModel::instance().addPeerProfile(person);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment