if (v != 0)
{
delete;
delete;
}
it need add code if (n != 0 && m != 0) before delete; same as deconstruction.
for my case, I call resize with n = 0, m = 19. it create a v with code v = new 
T*[n];
then call resize again with n = 1, m= 19.
it crash because v[0] not exists

below is the resize code.

inline void Matrix::resize(const unsigned int n, const unsigned int m)
{
register unsigned int i;
if (n == this->n && m == this->m)
return;
if (v != 0)
{
delete;
delete;
}
this->n = n; this->m = m;
v = new T*[n];
v[0] = new T[m * n];
for (i = 1; i < n; i++)
v[i] = v[i - 1] + m;
}

_______________________________________________
Bug-commoncpp mailing list
Bug-commoncpp@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-commoncpp

Reply via email to