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)
|
||||
{
|
||||
if (this != std::addressof(h)) {
|
||||
handle_type h_new = duplicate_internal(h.m_h);
|
||||
if (h_new) {
|
||||
if (h.m_h) {
|
||||
handle_type h_new = duplicate_internal(h.m_h);
|
||||
if (h_new) {
|
||||
if (m_h)
|
||||
free_internal();
|
||||
|
||||
m_h = h_new;
|
||||
} else
|
||||
assert(0); // Could not duplicate the handle
|
||||
} else {
|
||||
if (m_h)
|
||||
free_internal();
|
||||
|
||||
m_h = h_new;
|
||||
} else if (h.m_h)
|
||||
assert(0); // Could not duplicate the handle
|
||||
m_h = NULL;
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user