|
-
August 21st, 2008, 01:08 PM
#1
my copy constructor causes segmentation fault
hello guys,
i'm working with someone on a project. i always use windows, but he uses linux.
so i need to move my code to linux before giving him.
my code runs fine on my machine under linux, but he did some modification on the code and then we had a segmentation fault.
the problematic line is a rather simple copy constructor that i implemented by myself, not generated by the compiler:
Vector(const Vector &in):x(in.x),y(in.y),z(in.z)
{
}
i don't know why this line can be a problem. please help.
thank you so much
-
August 21st, 2008, 01:16 PM
#2
Re: my copy constructor causes segmentation fault
the error happens when i trying to do this line:
Math::Vector pre=edgeAroundVertexIter->middlePoint;
the error message also says:
const CGAL::HalfedgeDS_in_place_list_halfedge<CGAL::I_Polyhedron_halfedge<My_edge<CGAL::HalfedgeDS_list_types<CGAL::Cartesian<float>, CGAL::I_Polyhedron_derived_items_3<My_items>, std::allocator<int> > > > > &) @0x0: <error reading variable>
(gdb) p edgeAroundVertexIter->middlePoint
this is weird, because i'm pretty sure middlePoint is a member and there was no compiling error at all.
-
August 21st, 2008, 01:21 PM
#3
Re: my copy constructor causes segmentation fault
Most likely something is corrupting middlePoint prior to that. Run valgrind on it, that might give you a clue.
-
August 21st, 2008, 03:21 PM
#4
Re: my copy constructor causes segmentation fault
Hi,
Please provide the full class code, it is impossible to tell what went wrong just by looking at two lines...
--How often do you look at a man's shoes?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|