mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-22 00:01:09 -06:00
Bugfix: lack of strong type checking when passing arrayref objects to XS caused random lack of infill. Now added strong type checking for all XS entities. Also fixes a potential issue with bridges caused by the same error. #1652
Conflicts: lib/Slic3r/Layer/Region.pm
This commit is contained in:
parent
e68cbede6e
commit
a51743a8c1
9 changed files with 31 additions and 5 deletions
|
@ -180,6 +180,8 @@ void
|
|||
ExPolygon::from_SV_check(SV* expoly_sv)
|
||||
{
|
||||
if (sv_isobject(expoly_sv) && (SvTYPE(SvRV(expoly_sv)) == SVt_PVMG)) {
|
||||
if (!sv_isa(expoly_sv, "Slic3r::ExPolygon") && !sv_isa(expoly_sv, "Slic3r::ExPolygon::Ref"))
|
||||
CONFESS("Not a valid Slic3r::ExPolygon object");
|
||||
// a XS ExPolygon was supplied
|
||||
*this = *(ExPolygon *)SvIV((SV*)SvRV( expoly_sv ));
|
||||
} else {
|
||||
|
|
|
@ -88,6 +88,8 @@ void
|
|||
Line::from_SV_check(SV* line_sv)
|
||||
{
|
||||
if (sv_isobject(line_sv) && (SvTYPE(SvRV(line_sv)) == SVt_PVMG)) {
|
||||
if (!sv_isa(line_sv, "Slic3r::Line") && !sv_isa(line_sv, "Slic3r::Line::Ref"))
|
||||
CONFESS("Not a valid Slic3r::Line object");
|
||||
*this = *(Line*)SvIV((SV*)SvRV( line_sv ));
|
||||
} else {
|
||||
this->from_SV(line_sv);
|
||||
|
|
|
@ -169,6 +169,8 @@ void
|
|||
Point::from_SV_check(SV* point_sv)
|
||||
{
|
||||
if (sv_isobject(point_sv) && (SvTYPE(SvRV(point_sv)) == SVt_PVMG)) {
|
||||
if (!sv_isa(point_sv, "Slic3r::Point") && !sv_isa(point_sv, "Slic3r::Point::Ref"))
|
||||
CONFESS("Not a valid Slic3r::Point object");
|
||||
*this = *(Point*)SvIV((SV*)SvRV( point_sv ));
|
||||
} else {
|
||||
this->from_SV(point_sv);
|
||||
|
|
|
@ -166,6 +166,15 @@ Polygon::to_SV_clone_ref() const {
|
|||
sv_setref_pv( sv, "Slic3r::Polygon", new Polygon(*this) );
|
||||
return sv;
|
||||
}
|
||||
|
||||
void
|
||||
Polygon::from_SV_check(SV* poly_sv)
|
||||
{
|
||||
if (sv_isobject(poly_sv) && !sv_isa(poly_sv, "Slic3r::Polygon") && !sv_isa(poly_sv, "Slic3r::Polygon::Ref"))
|
||||
CONFESS("Not a valid Slic3r::Polygon object");
|
||||
|
||||
MultiPoint::from_SV_check(poly_sv);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ class Polygon : public MultiPoint {
|
|||
void simplify(double tolerance, Polygons &polygons) const;
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
void from_SV_check(SV* poly_sv);
|
||||
SV* to_SV_ref();
|
||||
SV* to_SV_clone_ref() const;
|
||||
#endif
|
||||
|
|
|
@ -110,6 +110,15 @@ Polyline::to_SV_clone_ref() const
|
|||
sv_setref_pv( sv, "Slic3r::Polyline", new Polyline(*this) );
|
||||
return sv;
|
||||
}
|
||||
|
||||
void
|
||||
Polyline::from_SV_check(SV* poly_sv)
|
||||
{
|
||||
if (!sv_isa(poly_sv, "Slic3r::Polyline") && !sv_isa(poly_sv, "Slic3r::Polyline::Ref"))
|
||||
CONFESS("Not a valid Slic3r::Polyline object");
|
||||
|
||||
MultiPoint::from_SV_check(poly_sv);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ class Polyline : public MultiPoint {
|
|||
void simplify(double tolerance);
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
void from_SV_check(SV* poly_sv);
|
||||
SV* to_SV_ref();
|
||||
SV* to_SV_clone_ref() const;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue