mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
previewpane: use RAII for FileExplorerPreviewSettings classes to avoid memory leaks
This commit is contained in:
committed by
Andrey Nekrasov
parent
6c62be1818
commit
f506980e4d
@@ -12,24 +12,16 @@ namespace PowerPreviewSettings
|
||||
extern "C" IMAGE_DOS_HEADER __ImageBase;
|
||||
|
||||
// Base Settings Class Implementation
|
||||
FileExplorerPreviewSettings::FileExplorerPreviewSettings(bool toggleSettingEnabled, const std::wstring& toggleSettingName, const std::wstring& toggleSettingDescription, LPCWSTR clsid, const std::wstring& registryValueData, RegistryWrapperIface* registryWrapper) :
|
||||
FileExplorerPreviewSettings::FileExplorerPreviewSettings(bool toggleSettingEnabled, const std::wstring& toggleSettingName, const std::wstring& toggleSettingDescription, LPCWSTR clsid, const std::wstring& registryValueData, std::unique_ptr<RegistryWrapperIface> registryWrapper) :
|
||||
m_toggleSettingEnabled(toggleSettingEnabled),
|
||||
m_toggleSettingName(toggleSettingName),
|
||||
m_toggleSettingDescription(toggleSettingDescription),
|
||||
m_clsid(clsid),
|
||||
m_registryValueData(registryValueData),
|
||||
m_registryWrapper(registryWrapper)
|
||||
m_registryWrapper(std::move(registryWrapper))
|
||||
{
|
||||
}
|
||||
|
||||
FileExplorerPreviewSettings::~FileExplorerPreviewSettings()
|
||||
{
|
||||
if (this->m_registryWrapper != NULL)
|
||||
{
|
||||
delete this->m_registryWrapper;
|
||||
}
|
||||
}
|
||||
|
||||
bool FileExplorerPreviewSettings::GetToggleSettingState() const
|
||||
{
|
||||
return this->m_toggleSettingEnabled;
|
||||
|
||||
Reference in New Issue
Block a user