mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
[VisualDeckStorage] Guard against widget deletion during tag edit dialog (#7674)
Co-authored-by: sentry[bot] <39604003+sentry[bot]@users.noreply.github.com>
This commit is contained in:
parent
aa42cfbccc
commit
92d082e735
1 changed files with 6 additions and 0 deletions
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include <QDialog>
|
||||
#include <QDir>
|
||||
#include <QPointer>
|
||||
#include <QDirIterator>
|
||||
#include <QHBoxLayout>
|
||||
#include <QSizePolicy>
|
||||
|
|
@ -117,8 +118,13 @@ void DeckPreviewDeckTagsDisplayWidget::openTagEditDlg()
|
|||
|
||||
void DeckPreviewDeckTagsDisplayWidget::execTagDialog(const QStringList &knownTags)
|
||||
{
|
||||
QPointer<DeckPreviewDeckTagsDisplayWidget> self(this);
|
||||
DeckPreviewTagDialog dialog(knownTags, currentTags);
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
// Guard against the widget being destroyed during dialog.exec()'s nested event loop.
|
||||
if (!self) {
|
||||
return;
|
||||
}
|
||||
QStringList updatedTags = dialog.getActiveTags();
|
||||
if (updatedTags != currentTags) {
|
||||
setTags(updatedTags);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue