xdgdesktopportal: Avoid dangling pointer
Use pointer to newly inserted element in 'filterList'
since local variable 'filter' goes out of scope at the end
of the block.
This is a follow-up for commit
3e09c28101
("Filechooser portal: Implement "current_filter").
Thanks to Giuseppe D'Angelo for pointing this out in that
commit's Gerrit change.
Pick-to: 5.15
Change-Id: I9af35c46315c7f90721d0d39b0fda6384c15786a
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This commit is contained in:
parent
c0097d1521
commit
32c09ea5b0
@ -236,7 +236,7 @@ void QXdgDesktopPortalFileDialog::openPortal()
|
|||||||
filterList << filter;
|
filterList << filter;
|
||||||
|
|
||||||
if (!d->selectedMimeTypeFilter.isEmpty() && d->selectedMimeTypeFilter == mimeTypefilter)
|
if (!d->selectedMimeTypeFilter.isEmpty() && d->selectedMimeTypeFilter == mimeTypefilter)
|
||||||
selectedFilter = &filter;
|
selectedFilter = &filterList.last();
|
||||||
}
|
}
|
||||||
} else if (!d->nameFilters.isEmpty()) {
|
} else if (!d->nameFilters.isEmpty()) {
|
||||||
for (const QString &nameFilter : d->nameFilters) {
|
for (const QString &nameFilter : d->nameFilters) {
|
||||||
@ -265,7 +265,7 @@ void QXdgDesktopPortalFileDialog::openPortal()
|
|||||||
d->userVisibleToNameFilter.insert(userVisibleName, nameFilter);
|
d->userVisibleToNameFilter.insert(userVisibleName, nameFilter);
|
||||||
|
|
||||||
if (!d->selectedNameFilter.isEmpty() && d->selectedNameFilter == nameFilter)
|
if (!d->selectedNameFilter.isEmpty() && d->selectedNameFilter == nameFilter)
|
||||||
selectedFilter = &filter;
|
selectedFilter = &filterList.last();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user