Don't use explicit memory management

And avoid dangling pointers.
This commit is contained in:
Chocobo1 2022-03-23 15:27:47 +08:00
commit bbd936fdfa
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
9 changed files with 28 additions and 36 deletions

View file

@ -114,9 +114,9 @@ namespace
{
QPixmap pixmapForExtension(const QString &ext) const override
{
const QString extWithDot = QLatin1Char('.') + ext;
const std::wstring extWStr = QString(u'.' + ext).toStdWString();
SHFILEINFO sfi {};
HRESULT hr = ::SHGetFileInfoW(extWithDot.toStdWString().c_str(),
HRESULT hr = ::SHGetFileInfoW(extWStr.c_str(),
FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(sfi), SHGFI_ICON | SHGFI_USEFILEATTRIBUTES);
if (FAILED(hr))
return {};