mirror of
https://github.com/reactos/reactos.git
synced 2026-05-30 14:34:57 +08:00
[ATL] Close m_hKey in CRegKey destructor and when attaching to a new key (#3764)
This commit is contained in:
@@ -1043,6 +1043,7 @@ public:
|
|||||||
|
|
||||||
~CRegKey() throw()
|
~CRegKey() throw()
|
||||||
{
|
{
|
||||||
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Attach(HKEY hKey) throw()
|
void Attach(HKEY hKey) throw()
|
||||||
@@ -1359,7 +1360,11 @@ public:
|
|||||||
|
|
||||||
CRegKey& operator=(CRegKey& key) throw()
|
CRegKey& operator=(CRegKey& key) throw()
|
||||||
{
|
{
|
||||||
Attach(key.Detach());
|
if (m_hKey != key.m_hKey)
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
Attach(key.Detach());
|
||||||
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user