Skip to content

Commit 0bd3b25

Browse files
committed
use Scalar::Util::weaken to break ref cycle
1 parent c2e0fb1 commit 0bd3b25

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/PDL/Graphics/TriD/Object.pm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package PDL::Graphics::TriD::Object;
22

33
use strict;
44
use warnings;
5+
use Scalar::Util qw(weaken);
56

67
use fields qw(Objects ValidList ChangedSub List Options);
78

@@ -48,9 +49,9 @@ sub delete_object {
4849
}
4950
}
5051

51-
# XXXXXXXXX sub {} makes all these objects and this window immortal!
5252
sub add_object {
53-
my($this,$object) = @_;
53+
my ($this,$object) = @_;
54+
weaken $this;
5455
push @{$this->{Objects}},$object;
5556
$this->{ValidList} = 0;
5657
for(@{$this->{ChangedSub}}) {

0 commit comments

Comments
 (0)