Linguist: MainWindow: fix Coverity BAD_FREE in askPreviewActivation()


Coverity complained that the QMessageBox was created on the stack and
exec() could delete it.

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.

That's only half the story here, since the code continues to interact
with the dialog even if exec() was rejected. To avoid a nullptr deref
on the now-reset-to-nullptr `box`, or, for that matter, members of
deleted *this, exit early.

Amends bce85894439cf665a62773d19aa5df208df28e31 (dev only)

Coverity-Id: 913326
Change-Id: I82f25c5df7d724c2e915f191ce95b94c8a3d4b81
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
commit01f604668d9f973193cc2f0fe4fdfd9371dbd503
parentb67ed65fedb883cca6adf05cbaaeb058b90af5be
authorMarc Mutz <marc.mutz@qt.io>
committerMarc Mutz <marc.mutz@qt.io>
commit timeThu, 1 Oct 2026 12:36:19 +0000