Issue with dplhandle<>::operator=() not overwriting non-NULL object with NULL one fixed
This commit is contained in:
parent
3872ddb465
commit
64d0ae5e69
@ -772,14 +772,21 @@ namespace winstd
|
|||||||
inline dplhandle<handle_type>& operator=(_In_ const dplhandle<handle_type> &h)
|
inline dplhandle<handle_type>& operator=(_In_ const dplhandle<handle_type> &h)
|
||||||
{
|
{
|
||||||
if (this != std::addressof(h)) {
|
if (this != std::addressof(h)) {
|
||||||
|
if (h.m_h) {
|
||||||
handle_type h_new = duplicate_internal(h.m_h);
|
handle_type h_new = duplicate_internal(h.m_h);
|
||||||
if (h_new) {
|
if (h_new) {
|
||||||
if (m_h)
|
if (m_h)
|
||||||
free_internal();
|
free_internal();
|
||||||
|
|
||||||
m_h = h_new;
|
m_h = h_new;
|
||||||
} else if (h.m_h)
|
} else
|
||||||
assert(0); // Could not duplicate the handle
|
assert(0); // Could not duplicate the handle
|
||||||
|
} else {
|
||||||
|
if (m_h)
|
||||||
|
free_internal();
|
||||||
|
|
||||||
|
m_h = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user