aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-08-19 08:22:57 +0200
committerMontel Laurent <[email protected]>2017-08-19 08:22:57 +0200
commit63c93de5ec197f769ec67a0fd397bee78cfeaf69 (patch)
tree13254bfcdc06ec8793f7a6a0267b72623952d0c5
parent4c050347bad86f4ea55c6581a4084dfee47c1a20 (diff)
Avoid potential crash
-rw-r--r--src/akonadi-contacts/emailaddressrequester.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/akonadi-contacts/emailaddressrequester.cpp b/src/akonadi-contacts/emailaddressrequester.cpp
index 0e421b4..ff5287b 100644
--- a/src/akonadi-contacts/emailaddressrequester.cpp
+++ b/src/akonadi-contacts/emailaddressrequester.cpp
@@ -48,14 +48,16 @@ public:
void EmailAddressRequester::Private::slotAddressBook()
{
- Akonadi::EmailAddressSelectionDialog dlg(q);
- dlg.view()->view()->setSelectionMode(QAbstractItemView::MultiSelection);
- if (!dlg.exec()) {
+ QPointer<Akonadi::EmailAddressSelectionDialog> dlg = new Akonadi::EmailAddressSelectionDialog(q);
+ dlg->view()->view()->setSelectionMode(QAbstractItemView::MultiSelection);
+ if (!dlg->exec()) {
+ delete dlg;
return;
}
+
QStringList addressList;
- const auto selectedAddresses = dlg.selectedAddresses();
+ const auto selectedAddresses = dlg->selectedAddresses();
addressList.reserve(selectedAddresses.size());
for (const Akonadi::EmailAddressSelection &selection : selectedAddresses) {
addressList << selection.quotedEmail();
@@ -72,6 +74,7 @@ void EmailAddressRequester::Private::slotAddressBook()
}
mLineEdit->setText(text + addressList.join(QLatin1Char(',')));
+ delete dlg;
}
EmailAddressRequester::EmailAddressRequester(QWidget *parent)