More memory leaks fixed

This commit is contained in:
Alessandro Ranellucci 2015-11-02 01:44:19 +01:00
parent 05812a0a60
commit 4e3784a2a9

View file

@ -231,11 +231,9 @@ sub new {
}); });
EVT_BUTTON($self, $self->{btn_print}, sub { EVT_BUTTON($self, $self->{btn_print}, sub {
$self->{print_file} = $self->export_gcode(Wx::StandardPaths::Get->GetTempDir()); $self->{print_file} = $self->export_gcode(Wx::StandardPaths::Get->GetTempDir());
Slic3r::thread_cleanup();
}); });
EVT_BUTTON($self, $self->{btn_send_gcode}, sub { EVT_BUTTON($self, $self->{btn_send_gcode}, sub {
$self->{send_gcode_file} = $self->export_gcode(Wx::StandardPaths::Get->GetTempDir()); $self->{send_gcode_file} = $self->export_gcode(Wx::StandardPaths::Get->GetTempDir());
Slic3r::thread_cleanup();
}); });
EVT_BUTTON($self, $self->{btn_export_stl}, \&export_stl); EVT_BUTTON($self, $self->{btn_export_stl}, \&export_stl);
@ -1291,9 +1289,6 @@ sub export_stl {
my $output_file = $self->_get_export_file('STL') or return; my $output_file = $self->_get_export_file('STL') or return;
Slic3r::Format::STL->write_file($output_file, $self->{model}, binary => 1); Slic3r::Format::STL->write_file($output_file, $self->{model}, binary => 1);
$self->statusbar->SetStatusText("STL file exported to $output_file"); $self->statusbar->SetStatusText("STL file exported to $output_file");
# this method gets executed in a separate thread by wxWidgets since it's a button handler
Slic3r::thread_cleanup() if $Slic3r::have_threads;
} }
sub export_object_stl { sub export_object_stl {
@ -1317,9 +1312,6 @@ sub export_amf {
my $output_file = $self->_get_export_file('AMF') or return; my $output_file = $self->_get_export_file('AMF') or return;
Slic3r::Format::AMF->write_file($output_file, $self->{model}); Slic3r::Format::AMF->write_file($output_file, $self->{model});
$self->statusbar->SetStatusText("AMF file exported to $output_file"); $self->statusbar->SetStatusText("AMF file exported to $output_file");
# this method gets executed in a separate thread by wxWidgets since it's a menu handler
Slic3r::thread_cleanup() if $Slic3r::have_threads;
} }
sub _get_export_file { sub _get_export_file {