Bug 1715944 - Set the cached theme handle to Nothing() if the holding value was null. r=Gijs

In the class stlye of Win7, `OpenThemeData` returns null.  The problem is
`ThemeHandle::Close()` did not reset the cached value to `Nothing()` if
the holding value was null.  As a result, we never fetch the theme handle
after the theme is changed.

Differential Revision: https://phabricator.services.mozilla.com/D121288
This commit is contained in:
Toshihito Kikuchi 2021-07-30 15:08:28 +00:00
Родитель a0e4108ae9
Коммит fefaf12909
1 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -39,12 +39,13 @@ void nsUXThemeData::ThemeHandle::OpenOnce(HWND aWindow, LPCWSTR aClassList) {
}
void nsUXThemeData::ThemeHandle::Close() {
if (mHandle.isNothing() || !mHandle.value()) {
if (mHandle.isNothing()) {
return;
}
CloseThemeData(mHandle.value());
mHandle = Nothing();
if (HANDLE rawHandle = mHandle.extract()) {
CloseThemeData(rawHandle);
}
}
nsUXThemeData::ThemeHandle::operator HANDLE() {