diff --git a/autotests/kfindtest.h b/autotests/kfindtest.h --- a/autotests/kfindtest.h +++ b/autotests/kfindtest.h @@ -32,7 +32,7 @@ Q_OBJECT public: - KFindRecorder(const QStringList &text) : + explicit KFindRecorder(const QStringList &text) : QObject(nullptr), m_find(nullptr), m_text(text), diff --git a/src/kregexpeditor/kregexpeditorinterface.h b/src/kregexpeditor/kregexpeditorinterface.h --- a/src/kregexpeditor/kregexpeditorinterface.h +++ b/src/kregexpeditor/kregexpeditorinterface.h @@ -20,8 +20,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef __kregexpeditorinterface_h__ -#define __kregexpeditorinterface_h__ +#ifndef KREGEXPEDITORINTERFACE_H +#define KREGEXPEDITORINTERFACE_H #include #include @@ -157,5 +157,5 @@ Q_DECLARE_INTERFACE(KRegExpEditorInterface, "org.kde.KRegExpEditorInterface/1.0") -#endif +#endif // KREGEXPEDITORINTERFACE_H diff --git a/src/widgets/krichtextwidget.cpp b/src/widgets/krichtextwidget.cpp --- a/src/widgets/krichtextwidget.cpp +++ b/src/widgets/krichtextwidget.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include "klinkdialog_p.h" @@ -630,16 +631,15 @@ void KRichTextWidget::Private::_k_manageLink() { q->selectLinkText(); - KLinkDialog *linkDialog = new KLinkDialog(q); + QPointer linkDialog = new KLinkDialog(q); linkDialog->setLinkText(q->currentLinkText()); linkDialog->setLinkUrl(q->currentLinkUrl()); - if (linkDialog->exec()) { + if (linkDialog->exec() && linkDialog) { q->updateLink(linkDialog->linkUrl(), linkDialog->linkText()); } delete linkDialog; - } void KRichTextWidget::mouseReleaseEvent(QMouseEvent *event) diff --git a/src/widgets/ktextedit.cpp b/src/widgets/ktextedit.cpp --- a/src/widgets/ktextedit.cpp +++ b/src/widgets/ktextedit.cpp @@ -34,6 +34,7 @@ #include #endif #include +#include #include #include @@ -358,16 +359,18 @@ void KTextEdit::showSpellConfigDialog(const QString &windowIcon) { - Sonnet::ConfigDialog dialog(this); + QPointer dialog = new Sonnet::ConfigDialog(this); if (!d->spellCheckingLanguage.isEmpty()) { - dialog.setLanguage(d->spellCheckingLanguage); + dialog->setLanguage(d->spellCheckingLanguage); } if (!windowIcon.isEmpty()) { - dialog.setWindowIcon(QIcon::fromTheme(windowIcon, dialog.windowIcon())); + dialog->setWindowIcon(QIcon::fromTheme(windowIcon, dialog->windowIcon())); } - if (dialog.exec()) { - setSpellCheckingLanguage(dialog.language()); + if (dialog->exec() && dialog) { + setSpellCheckingLanguage(dialog->language()); } + + delete dialog; } bool KTextEdit::event(QEvent *ev)