Make threaded perls work with XS data in plater thumbnails. Includes cleaner ->arrayref implementation

This commit is contained in:
Alessandro Ranellucci 2013-07-11 19:34:37 +02:00
parent fb7cea3cb9
commit 89fae9ee15
2 changed files with 5 additions and 6 deletions

View file

@ -741,12 +741,11 @@ sub make_thumbnail {
if ($Slic3r::have_threads) {
Wx::PostEvent($self, Wx::PlThreadEvent->new(-1, $THUMBNAIL_DONE_EVENT, shared_clone([ $obj_idx, $thumbnail ])));
Slic3r::thread_cleanup();
threads->exit;
} else {
$self->on_thumbnail_made($obj_idx);
}
Slic3r::thread_cleanup() if $Slic3r::have_threads;
};
@_ = ();

View file

@ -29,12 +29,12 @@ ExPolygon::new(...)
SV*
ExPolygon::arrayref()
CODE:
const unsigned int num_holes = THIS->holes.size();
AV* av = newAV();
av_fill(av, num_holes); // -1 +1
av_fill(av, THIS->holes.size()); // -1 +1
av_store(av, 0, polygon2perl(THIS->contour));
for (unsigned int i = 0; i < num_holes; i++) {
av_store(av, i+1, polygon2perl(THIS->holes[i]));
int i = 0;
for (Polygons::iterator it = THIS->holes.begin(); it != THIS->holes.end(); ++it) {
av_store(av, ++i, polygon2perl(*it));
}
RETVAL = sv_bless(newRV_noinc((SV*)av), gv_stashpv("Slic3r::ExPolygon", GV_ADD));
OUTPUT: