mirror of
https://github.com/reactos/reactos.git
synced 2025-06-15 07:48:30 +00:00
[ATL] Close m_hKey in CRegKey destructor and when attaching to a new key (#3764)
This commit is contained in:
parent
aa2697df2d
commit
42e111f26b
1 changed files with 6 additions and 1 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue