for(unsigned int i = 0; i < 3; ++i)
delete [] groups[i];
should be
for(unsigned int i = 0; i < 3; ++i)
delete groups[i];
new/delete
, new [] /delete []
should always match. In your case just use std::vector<std::shared_ptr<Group> > groups;
will be a better way.
where I finally got to a point where it seems that there is an "Invalid memory access" in my code but only if my class has a destructor.
using wrong delete[]
is why your application is crashing, it has nothing to do with your destructor in this case, unless you have something hidden in your destructor but that will be another bug.