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

@ -218,17 +218,23 @@ 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)
{ {
blocks = d.blocks; if(&d != this)
count = d.count; {
++(*count); blocks = d.blocks;
guard = this; count = d.count;
++(*count);
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)
{ {
free_(); if(&d != this)
blocks = d.blocks; {
count = d.count; free_();
++(*count); blocks = d.blocks;
count = d.count;
++(*count);
}
return *this; return *this;
} }