Fixed copy self assignment bug

[SVN r12248]
This commit is contained in:
John Maddock
2002-01-08 13:00:08 +00:00
parent 52dbd281ca
commit e22aaa9d20

View File

@ -217,18 +217,24 @@ jm_debug_alloc::jm_debug_alloc()
} }
jm_debug_alloc::jm_debug_alloc(const jm_debug_alloc& d) jm_debug_alloc::jm_debug_alloc(const jm_debug_alloc& d)
{
if(&d != this)
{ {
blocks = d.blocks; blocks = d.blocks;
count = d.count; count = d.count;
++(*count); ++(*count);
guard = this; guard = this;
} }
}
jm_debug_alloc& jm_debug_alloc::operator=(const jm_debug_alloc& d) jm_debug_alloc& jm_debug_alloc::operator=(const jm_debug_alloc& d)
{
if(&d != this)
{ {
free_(); free_();
blocks = d.blocks; blocks = d.blocks;
count = d.count; count = d.count;
++(*count); ++(*count);
}
return *this; return *this;
} }