From 05812a0a605e338b19bbd24b35e5920ab5d87fe8 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Mon, 2 Nov 2015 01:36:35 +0100 Subject: [PATCH] Fixed memory leak --- lib/Slic3r.pm | 5 +++++ lib/Slic3r/GUI/Plater.pm | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Slic3r.pm b/lib/Slic3r.pm index 0b0f01237..be2979121 100644 --- a/lib/Slic3r.pm +++ b/lib/Slic3r.pm @@ -172,6 +172,11 @@ sub parallelize { sub thread_cleanup { return if !$Slic3r::have_threads; + if (threads->tid == 0) { + warn "Calling thread_cleanup() from main thread\n"; + return; + } + # prevent destruction of shared objects no warnings 'redefine'; *Slic3r::BridgeDetector::DESTROY = sub {}; diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 69a0ee642..8b6dbb213 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -298,7 +298,6 @@ sub new { EVT_COMMAND($self, -1, $PROCESS_COMPLETED_EVENT, sub { my ($self, $event) = @_; $self->on_process_completed($event->GetData); - Slic3r::thread_cleanup(); }); if ($Slic3r::have_threads) {