From 82ef9ccd3acfe6bc576d97402f71df1848317f96 Mon Sep 17 00:00:00 2001 From: Jekyll Wu Date: Sun, 6 Nov 2011 12:06:31 +0800 Subject: [PATCH] Fix 2 Krazy issues with modal dialog --- src/ManageProfilesDialog.cpp | 9 ++++----- src/SessionController.cpp | 5 ++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/ManageProfilesDialog.cpp b/src/ManageProfilesDialog.cpp index 045a70dd9..57195ddb8 100644 --- a/src/ManageProfilesDialog.cpp +++ b/src/ManageProfilesDialog.cpp @@ -351,8 +351,6 @@ void ManageProfilesDialog::moveDownSelected() void ManageProfilesDialog::createProfile() { - EditProfileDialog dialog(this); - // setup a temporary profile which is a clone of the selected profile // or the default if no profile is selected Profile::Ptr sourceProfile; @@ -370,10 +368,11 @@ void ManageProfilesDialog::createProfile() newProfile->setProperty(Profile::Name, i18nc("@item This will be used as part of the file name", "New Profile")); newProfile->setProperty(Profile::MenuIndex, QString("0")); - dialog.setProfile(newProfile); - dialog.selectProfileName(); + QPointer dialog = new EditProfileDialog(this); + dialog->setProfile(newProfile); + dialog->selectProfileName(); - if ( dialog.exec() == QDialog::Accepted ) + if ( dialog->exec() == QDialog::Accepted ) { SessionManager::instance()->addProfile(newProfile); SessionManager::instance()->setFavorite(newProfile,true); diff --git a/src/SessionController.cpp b/src/SessionController.cpp index d6f5c58cb..e420f646f 100644 --- a/src/SessionController.cpp +++ b/src/SessionController.cpp @@ -785,7 +785,7 @@ void SessionController::copyInputToSelectedTabs() _copyToGroup->setMasterMode(SessionGroup::CopyInputToAll); } - CopyInputDialog* dialog = new CopyInputDialog(_view); + QPointer dialog = new CopyInputDialog(_view); dialog->setMasterSession(_session); QSet currentGroup = QSet::fromList(_copyToGroup->sessions()); @@ -798,7 +798,7 @@ void SessionController::copyInputToSelectedTabs() if (!guard) return; - if (result) + if ( result == QDialog::Accepted ) { QSet newGroup = dialog->chosenSessions(); newGroup.remove(_session); @@ -817,7 +817,6 @@ void SessionController::copyInputToSelectedTabs() snapshot(); } - delete dialog; _copyToAllTabsAction->setChecked(false); _copyToSelectedAction->setChecked(true); _copyToNoneAction->setChecked(false);