Commit f1282dda authored by Laurent Montel's avatar Laurent Montel 😁

Fix potential crash

parent 9e12db88
......@@ -391,10 +391,11 @@ void SieveEditorTextModeWidget::printPreview()
if (w == mEditorWidget) {
bool restoreSpellCheck = mTextEdit->checkSpellingEnabled();
mTextEdit->setCheckSpellingEnabled(false);
PimCommon::KPimPrintPreviewDialog previewdlg(this);
connect(&previewdlg, &QPrintPreviewDialog::paintRequested, this, [this](QPrinter *printer) { mTextEdit->print(printer);
QPointer<PimCommon::KPimPrintPreviewDialog> previewdlg = new PimCommon::KPimPrintPreviewDialog(this);
connect(previewdlg, &QPrintPreviewDialog::paintRequested, this, [this](QPrinter *printer) { mTextEdit->print(printer);
});
previewdlg.exec();
previewdlg->exec();
delete previewdlg;
mTextEdit->setCheckSpellingEnabled(restoreSpellCheck);
}
}
......
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