From 0bc09f0b65d78dedaf65719b47f7c4d12e28e502 Mon Sep 17 00:00:00 2001
From: Renato Araujo Oliveira Filho <renato.filho@canonical.com>
Date: Tue, 4 Feb 2014 15:27:34 -0300
Subject: [PATCH] Set the contact detail parent to avoid memory leak.

Change-Id: I4eed6039c398d537254441e4e5873838a7866c6c
---
 src/imports/contacts/qdeclarativecontact.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/imports/contacts/qdeclarativecontact.cpp b/src/imports/contacts/qdeclarativecontact.cpp
index f4c99e7..e64c6e5 100644
--- a/src/imports/contacts/qdeclarativecontact.cpp
+++ b/src/imports/contacts/qdeclarativecontact.cpp
@@ -133,6 +133,7 @@ void QDeclarativeContact::setContact(const QContact& contact)
     QList<QContactDetail> details(contact.details());
     foreach (const QContactDetail &detail, details) {
         QDeclarativeContactDetail *contactDetail = QDeclarativeContactDetailFactory::createContactDetail(static_cast<QDeclarativeContactDetail::DetailType>(detail.type()));
+        contactDetail->setParent(this);
         contactDetail->setDetail(detail);
         connect(contactDetail, SIGNAL(detailChanged()), this, SIGNAL(contactChanged()));
         m_details.append(contactDetail);
@@ -254,6 +255,7 @@ bool QDeclarativeContact::addDetail(QDeclarativeContactDetail* detail)
         return false;
 
     QDeclarativeContactDetail *contactDetail = QDeclarativeContactDetailFactory::createContactDetail(detail->detailType());
+    contactDetail->setParent(this);
     contactDetail->setDetail(detail->detail());
     connect(contactDetail, SIGNAL(detailChanged()), this, SIGNAL(contactChanged()));
     m_details.append(contactDetail);
-- 
1.8.5.3

