From 4be1e5702ad969d4ed4cd5ccc611f9de21940c1d Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 12 Nov 2013 21:49:34 +0100 Subject: [PATCH] Free memory after closing the preview and the setting windows --- lib/Slic3r/GUI/Plater/ObjectPreviewDialog.pm | 8 +++++++- lib/Slic3r/GUI/Plater/ObjectSettingsDialog.pm | 1 + lib/Slic3r/GUI/PreviewCanvas.pm | 4 ---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/Slic3r/GUI/Plater/ObjectPreviewDialog.pm b/lib/Slic3r/GUI/Plater/ObjectPreviewDialog.pm index fbcc5d776..671fe430b 100644 --- a/lib/Slic3r/GUI/Plater/ObjectPreviewDialog.pm +++ b/lib/Slic3r/GUI/Plater/ObjectPreviewDialog.pm @@ -4,7 +4,7 @@ use warnings; use utf8; use Wx qw(:dialog :id :misc :sizer :systemsettings :notebook wxTAB_TRAVERSAL); -use Wx::Event qw(EVT_BUTTON); +use Wx::Event qw(EVT_CLOSE); use base 'Wx::Dialog'; sub new { @@ -18,6 +18,12 @@ sub new { $self->SetSizer($sizer); $self->SetMinSize($self->GetSize); + # needed to actually free memory + EVT_CLOSE($self, sub { + $self->EndModal(wxID_OK); + $self->Destroy; + }); + return $self; } diff --git a/lib/Slic3r/GUI/Plater/ObjectSettingsDialog.pm b/lib/Slic3r/GUI/Plater/ObjectSettingsDialog.pm index 6f8ef8ffe..cf559f57e 100644 --- a/lib/Slic3r/GUI/Plater/ObjectSettingsDialog.pm +++ b/lib/Slic3r/GUI/Plater/ObjectSettingsDialog.pm @@ -29,6 +29,7 @@ sub new { $self->{materials}->Closing; $self->EndModal(wxID_OK); + $self->Destroy; }); my $sizer = Wx::BoxSizer->new(wxVERTICAL); diff --git a/lib/Slic3r/GUI/PreviewCanvas.pm b/lib/Slic3r/GUI/PreviewCanvas.pm index 44c21c932..69626d44c 100644 --- a/lib/Slic3r/GUI/PreviewCanvas.pm +++ b/lib/Slic3r/GUI/PreviewCanvas.pm @@ -323,10 +323,6 @@ sub Resize { } } -sub DESTROY { - my $self = shift; -} - sub InitGL { my $self = shift;