Bug in copying a mesh

Issue #341 resolved
Christoph Rupprecht created an issue

Hi,

I found a problem in the function const Mesh& Mesh::operator=(const Mesh& mesh).

If your code is something like

Rectangle mesh(0,0,1,1,4,4);
mesh = mesh;

then mesh._cell_type is destroyed. As soon as something is done with the mesh the program crashes with a segmentation fault.

Maybe some check like

if (this != &mesh)
   return;

would help.

Comments (4)

  1. Log in to comment