From kde-commits Fri Apr 30 23:08:20 2010 From: David Jarvie Date: Fri, 30 Apr 2010 23:08:20 +0000 To: kde-commits Subject: KDE/kdepim/kalarm Message-Id: <20100430230820.E2656AC8AA () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=127266869305255 SVN commit 1121253 by djarvie: Krazy fix: use QPointer for dialogs M +7 -3 editdlgtypes.cpp --- trunk/KDE/kdepim/kalarm/editdlgtypes.cpp #1121252:1121253 @@ -22,6 +22,7 @@ #include "editdlgtypes.moc" #include "editdlgprivate.h" +#include "autoqpointer.h" #include "buttongroup.h" #include "checkbox.h" #include "colourbutton.h" @@ -1367,11 +1368,14 @@ */ void EditEmailAlarmDlg::openAddressBook() { - Akonadi::EmailAddressSelectionDialog dlg(this); - if (!dlg.exec()) + // Use AutoQPointer to guard against crash on application exit while + // the dialogue is still open. It prevents double deletion (both on + // deletion of MainWindow, and on return from this function). + AutoQPointer dlg = new Akonadi::EmailAddressSelectionDialog(this); + if (dlg->exec() != QDialog::Accepted) return; - Akonadi::EmailAddressSelectionView::Selection::List selections = dlg.selectedAddresses(); + Akonadi::EmailAddressSelectionView::Selection::List selections = dlg->selectedAddresses(); if (selections.isEmpty()) return; Person person(selections.first().name(), selections.first().email());