Fixed memory leak

This commit is contained in:
Alessandro Ranellucci 2015-11-02 01:36:35 +01:00
parent b309c61de3
commit 05812a0a60
2 changed files with 5 additions and 1 deletions

View File

@ -172,6 +172,11 @@ sub parallelize {
sub thread_cleanup { sub thread_cleanup {
return if !$Slic3r::have_threads; return if !$Slic3r::have_threads;
if (threads->tid == 0) {
warn "Calling thread_cleanup() from main thread\n";
return;
}
# prevent destruction of shared objects # prevent destruction of shared objects
no warnings 'redefine'; no warnings 'redefine';
*Slic3r::BridgeDetector::DESTROY = sub {}; *Slic3r::BridgeDetector::DESTROY = sub {};

View File

@ -298,7 +298,6 @@ sub new {
EVT_COMMAND($self, -1, $PROCESS_COMPLETED_EVENT, sub { EVT_COMMAND($self, -1, $PROCESS_COMPLETED_EVENT, sub {
my ($self, $event) = @_; my ($self, $event) = @_;
$self->on_process_completed($event->GetData); $self->on_process_completed($event->GetData);
Slic3r::thread_cleanup();
}); });
if ($Slic3r::have_threads) { if ($Slic3r::have_threads) {