Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 06f7117f authored by Laurent Montel's avatar Laurent Montel 😁

Fix potential crash

parent dd1f63bf
......@@ -331,9 +331,10 @@ void KTNEFMain::extractAllFiles()
void KTNEFMain::propertiesFile()
{
KTNEFAttach *attach = mView->getSelection().at(0);
AttachPropertyDialog dlg(this);
dlg.setAttachment(attach);
dlg.exec();
QPointer<AttachPropertyDialog> dlg = new AttachPropertyDialog(this);
dlg->setAttachment(attach);
dlg->exec();
delete dlg;
}
void KTNEFMain::optionDefaultDir()
......@@ -477,9 +478,10 @@ void KTNEFMain::slotEditToolbars()
KConfigGroup grp = KSharedConfig::openConfig()->group("MainWindow");
saveMainWindowSettings(grp);
KEditToolBar dlg(factory());
connect(&dlg, &KEditToolBar::newToolBarConfig, this, &KTNEFMain::slotNewToolbarConfig);
dlg.exec();
QPointer<KEditToolBar> dlg = new KEditToolBar(factory());
connect(dlg, &KEditToolBar::newToolBarConfig, this, &KTNEFMain::slotNewToolbarConfig);
dlg->exec();
delete dlg;
}
void KTNEFMain::slotNewToolbarConfig()
......@@ -490,8 +492,9 @@ void KTNEFMain::slotNewToolbarConfig()
void KTNEFMain::slotShowMessageProperties()
{
MessagePropertyDialog dlg(this, mParser->message());
dlg.exec();
QPointer<MessagePropertyDialog> dlg = new MessagePropertyDialog(this, mParser->message());
dlg->exec();
delete dlg;
}
void KTNEFMain::slotShowMessageText()
......
......@@ -213,8 +213,9 @@ AccountsPageReceivingTab::~AccountsPageReceivingTab()
void AccountsPageReceivingTab::slotCustomizeAccountOrder()
{
MailCommon::AccountConfigOrderDialog dlg(this);
dlg.exec();
QPointer<MailCommon::AccountConfigOrderDialog> dlg = new MailCommon::AccountConfigOrderDialog(this);
dlg->exec();
delete dlg;
}
void AccountsPageReceivingTab::slotShowMailCheckMenu(const QString &ident, const QPoint &pos)
......
......@@ -119,32 +119,33 @@ QString KMComposerEditorNg::smartQuote(const QString &msg)
void KMComposerEditorNg::showSpellConfigDialog(const QString &configFileName)
{
Q_UNUSED(configFileName);
Sonnet::ConfigDialog dialog(this);
QPointer<Sonnet::ConfigDialog> dialog = new Sonnet::ConfigDialog(this);
if (!spellCheckingLanguage().isEmpty()) {
dialog.setLanguage(spellCheckingLanguage());
dialog->setLanguage(spellCheckingLanguage());
}
// Hackish way to hide the "Enable spell check by default" checkbox
// Our highlighter ignores this setting, so we should not expose its UI
QCheckBox *enabledByDefaultCB = dialog.findChild<QCheckBox *>(QStringLiteral("m_checkerEnabledByDefaultCB"));
QCheckBox *enabledByDefaultCB = dialog->findChild<QCheckBox *>(QStringLiteral("m_checkerEnabledByDefaultCB"));
if (enabledByDefaultCB) {
enabledByDefaultCB->hide();
} else {
qCWarning(KMAIL_LOG) << "Could not find any checkbox named 'm_checkerEnabledByDefaultCB'. Sonnet::ConfigDialog must have changed!";
}
QLabel *textLabel = dialog.findChild<QLabel *>(QStringLiteral("textLabel1"));
QLabel *textLabel = dialog->findChild<QLabel *>(QStringLiteral("textLabel1"));
if (textLabel) {
textLabel->hide();
} else {
qCWarning(KMAIL_LOG) << "Could not find any label named 'textLabel'. Sonnet::ConfigDialog must have changed!";
}
Sonnet::DictionaryComboBox *dictionaryComboBox = dialog.findChild<Sonnet::DictionaryComboBox *>(QStringLiteral("m_langCombo"));
Sonnet::DictionaryComboBox *dictionaryComboBox = dialog->findChild<Sonnet::DictionaryComboBox *>(QStringLiteral("m_langCombo"));
if (dictionaryComboBox) {
dictionaryComboBox->hide();
} else {
qCWarning(KMAIL_LOG) << "Could not find any Sonnet::DictionaryComboBox named 'dictionaryComboBox'. Sonnet::ConfigDialog must have changed!";
}
if (dialog.exec()) {
setSpellCheckingLanguage(dialog.language());
if (dialog->exec()) {
setSpellCheckingLanguage(dialog->language());
}
delete dialog;
}
......@@ -3018,11 +3018,12 @@ void KMComposerWin::slotEditToolbars()
{
KConfigGroup grp(KMKernel::self()->config()->group("Composer"));
saveMainWindowSettings(grp);
KEditToolBar dlg(guiFactory(), this);
QPointer<KEditToolBar> dlg = new KEditToolBar(guiFactory(), this);
connect(&dlg, &KEditToolBar::newToolBarConfig, this, &KMComposerWin::slotUpdateToolbars);
connect(dlg, &KEditToolBar::newToolBarConfig, this, &KMComposerWin::slotUpdateToolbars);
dlg.exec();
dlg->exec();
delete dlg;
}
void KMComposerWin::slotUpdateToolbars()
......
......@@ -48,9 +48,10 @@ PotentialPhishingEmailWarning::~PotentialPhishingEmailWarning()
void PotentialPhishingEmailWarning::slotShowDetails(const QString &link)
{
if (link == QLatin1String("phishingdetails")) {
PotentialPhishingDetailDialog dlg(this);
dlg.fillList(mPotentialPhishingEmails);
dlg.exec();
QPointer<PotentialPhishingDetailDialog> dlg = new PotentialPhishingDetailDialog(this);
dlg->fillList(mPotentialPhishingEmails);
dlg->exec();
delete dlg;
}
}
......
......@@ -35,6 +35,7 @@
#include <KLocalizedString>
#include <KMessageBox>
#include <QPointer>
CreateNewContactJob::CreateNewContactJob(QWidget *parentWidget, QObject *parent)
: KJob(parent)
......@@ -120,10 +121,11 @@ void CreateNewContactJob::slotResourceCreationDone(KJob *job)
void CreateNewContactJob::createContact()
{
Akonadi::ContactEditorDialog dlg(Akonadi::ContactEditorDialog::CreateMode, mParentWidget);
connect(&dlg, &Akonadi::ContactEditorDialog::contactStored, this, &CreateNewContactJob::contactStored);
connect(&dlg, &Akonadi::ContactEditorDialog::error, this, &CreateNewContactJob::slotContactEditorError);
dlg.exec();
QPointer<Akonadi::ContactEditorDialog> dlg = new Akonadi::ContactEditorDialog(Akonadi::ContactEditorDialog::CreateMode, mParentWidget);
connect(dlg, &Akonadi::ContactEditorDialog::contactStored, this, &CreateNewContactJob::contactStored);
connect(dlg, &Akonadi::ContactEditorDialog::error, this, &CreateNewContactJob::slotContactEditorError);
dlg->exec();
delete dlg;
}
void CreateNewContactJob::contactStored(const Akonadi::Item &item)
......
......@@ -1508,9 +1508,10 @@ void KMMainWidget::slotEmptyFolder()
void KMMainWidget::slotArchiveFolder()
{
if (mCurrentCollection.isValid()) {
KMail::ArchiveFolderDialog archiveDialog;
archiveDialog.setFolder(mCurrentCollection);
archiveDialog.exec();
QPointer<KMail::ArchiveFolderDialog> archiveDialog = new KMail::ArchiveFolderDialog(this);
archiveDialog->setFolder(mCurrentCollection);
archiveDialog->exec();
delete archiveDialog;
}
}
......@@ -1937,13 +1938,14 @@ void KMMainWidget::slotSelectMoreMessageTagList()
return;
}
TagSelectDialog dlg(this, selectedMessages.count(), selectedMessages.first());
dlg.setActionCollection(QList<KActionCollection *> { actionCollection() });
if (dlg.exec()) {
const Akonadi::Tag::List lst = dlg.selectedTag();
QPointer<TagSelectDialog> dlg = new TagSelectDialog(this, selectedMessages.count(), selectedMessages.first());
dlg->setActionCollection(QList<KActionCollection *> { actionCollection() });
if (dlg->exec()) {
const Akonadi::Tag::List lst = dlg->selectedTag();
KMCommand *command = new KMSetTagCommand(lst, selectedMessages, KMSetTagCommand::CleanExistingAndAddNew);
command->start();
}
delete dlg;
}
void KMMainWidget::slotUpdateMessageTagList(const Akonadi::Tag &tag)
......@@ -3629,8 +3631,9 @@ void KMMainWidget::slotAddFavoriteFolder()
//-----------------------------------------------------------------------------
void KMMainWidget::slotEditNotifications()
{
KMail::KMKnotify notifyDlg(this);
notifyDlg.exec();
QPointer<KMail::KMKnotify> notifyDlg = new KMail::KMKnotify(this);
notifyDlg->exec();
delete notifyDlg;
}
//-----------------------------------------------------------------------------
......
......@@ -148,10 +148,11 @@ void KMMainWin::slotEditToolbars()
{
KConfigGroup grp = KMKernel::self()->config()->group("Main Window");
saveMainWindowSettings(grp);
KEditToolBar dlg(guiFactory(), this);
connect(&dlg, &KEditToolBar::newToolBarConfig, this, &KMMainWin::slotUpdateGui);
QPointer<KEditToolBar> dlg = new KEditToolBar(guiFactory(), this);
connect(dlg, &KEditToolBar::newToolBarConfig, this, &KMMainWin::slotUpdateGui);
dlg.exec();
dlg->exec();
delete dlg;
}
void KMMainWin::slotUpdateGui()
......
......@@ -658,9 +658,10 @@ void KMReaderMainWin::slotEditToolbars()
{
KConfigGroup grp(KMKernel::self()->config(), "ReaderWindow");
saveMainWindowSettings(grp);
KEditToolBar dlg(guiFactory(), this);
connect(&dlg, &KEditToolBar::newToolBarConfig, this, &KMReaderMainWin::slotUpdateToolbars);
dlg.exec();
QPointer<KEditToolBar> dlg = new KEditToolBar(guiFactory(), this);
connect(dlg, &KEditToolBar::newToolBarConfig, this, &KMReaderMainWin::slotUpdateToolbars);
dlg->exec();
delete dlg;
}
void KMReaderMainWin::slotUpdateToolbars()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment