diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index ec9ea2e14..09d15886d 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -1541,7 +1541,7 @@ sub object_cut_dialog { object => $self->{objects}[$obj_idx], model_object => $self->{model}->objects->[$obj_idx], ); - $dlg->ShowModal; + return unless $dlg->ShowModal == wxID_OK; if (my @new_objects = $dlg->NewModelObjects) { $self->remove($obj_idx); diff --git a/lib/Slic3r/GUI/Plater/ObjectCutDialog.pm b/lib/Slic3r/GUI/Plater/ObjectCutDialog.pm index ad4ab9221..e7f0629e7 100644 --- a/lib/Slic3r/GUI/Plater/ObjectCutDialog.pm +++ b/lib/Slic3r/GUI/Plater/ObjectCutDialog.pm @@ -111,14 +111,9 @@ sub new { $self->SetMinSize($self->GetSize); $self->{sizer}->SetSizeHints($self); - # needed to actually free memory - EVT_CLOSE($self, sub { - $self->EndModal(wxID_OK); - $self->Destroy; - }); - EVT_BUTTON($self, $self->{btn_cut}, sub { $self->perform_cut(1); + $self->EndModal(wxID_OK); $self->Close; });