[Bug] rs_actiondrawellipsecenter3point
Posted by cantcode on Jun 04, 2013; 11:54am
URL: https://forum.librecad.org/Bug-rs-actiondrawellipsecenter3point-tp5708194.html
Hey guys cause I would like to learn how to code, I was trying to find the cause of a bug.
When drawing an ellipse from the center and three points (rs_actiondrawellipsecenter3points)
there seems to be a bug.
Trying to figure out what causes the crash I ended up in
LibreCAD-master/librecad/src/lib/math/lc_quadratic.cpp
at the line 416
return getIntersection(p1->flipXY(),p2->flipXY()).flipXY();
this line calls
LC_Quadratic LC_Quadratic::flipXY(void) const
and in here, a new LC_Quadratic object is created
LC_Quadratic qf(*this);
the problem is the above line calls the copyconstructor and it seems like the constructor
does not copy/create the m_mQuad attribute when the old m_mQuad is not quadratic ->size of m_mQuad is 0!!!! .
that's no problem until the line 422 (in lc_quadratic.cpp)
fabs(p2->m_mQuad(0,0))<RS_TOLERANCE && fabs(p2->m_mQuad(0,1))<RS_TOLERANCE
in RS_VectorSolutions LC_Quadratic::getIntersection(const LC_Quadratic& l1, const LC_Quadratic& l2)
because the size of m_mQuad is 0, boost throws an exception and LCAD crashes.