Linguist: MainWindow: fix Coverity BAD_FREE in print*()
Coverity complained QPrintDialogs were created on the stack and exec()
could delete them.
The False Positive triage in Coverity UI is wrong: This is Coverity's
roundabout way of pointing out that the decades-old¹ stack-allocated
dialog antipattern is active here.
¹ https://blogs.kde.org/2009/03/26/how-crash-almost-every-qtkde-application-and-how-fix-it-0/
Apply the usual fix: hold the dialog in QAutoPointer, so it's not
deleted twice.
As a caveat, the functions access statusBar() even if the dialog was
rejected, so guard those calls with if (dlg), too, lest they call
statusBar() on a deleted *this. Strictly speaking, dlg could
DeleteOnClose, in which case this would be the wrong check, but if
the code follows the recommended pattern of never setting
DeleteOnClose from the dialog itself, and only close to where it is
created, this will be obvious, so don't make the code unnecessarily
complicated by introducing yet another QPointer that = this.
Amends the start of the public history in this module.
Pick-to: 6.12 6.8
Coverity-Id: 218708
Coverity-Id: 218545
Change-Id: Ia1141468820ac4fcf9185b0a6a064cc2e120c796
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>