From a1d8dbd67a974d701cfb56ff3b5c7a71340d2502 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Sun, 18 Apr 2010 18:48:59 -0500 Subject: [PATCH] more object destruction cleanups --- lib/WebGUI/Asset.pm | 21 --------------------- lib/WebGUI/Asset/Post.pm | 9 ++++----- lib/WebGUI/Asset/Post/Thread.pm | 13 ++++++------- lib/WebGUI/Asset/Wobject/GalleryAlbum.pm | 2 +- 4 files changed, 11 insertions(+), 34 deletions(-) diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index 90888c497..80a9b9a1c 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -669,27 +669,6 @@ sub drawExtraHeadTags { }); } - -#------------------------------------------------------------------- - -=head2 DESTROY ( ) - -Completely remove an asset from existence. - -=cut - -sub DESTROY { - my $self = shift; - - # Let the parent be garbage collected if no one else is referencing - # him. firstChild and lastChild are weak references, so no need to - # worry about them here. - delete $self->{_parent}; - - $self = undef; -} - - #------------------------------------------------------------------- =head2 extraHeadTags ( value ) diff --git a/lib/WebGUI/Asset/Post.pm b/lib/WebGUI/Asset/Post.pm index 80b7e6ff2..05c5e734a 100644 --- a/lib/WebGUI/Asset/Post.pm +++ b/lib/WebGUI/Asset/Post.pm @@ -321,11 +321,10 @@ Extend the base method to delete the locally cached thread object. =cut -override DESTROY => sub { - my $self = shift; - $self->{_thread}->DESTROY if (exists $self->{_thread} && ref $self->{_thread} =~ /Thread/); - super(); -}; +sub DEMOLISH { + my $self = shift; + $self->{_thread}->DESTROY if (exists $self->{_thread} && ref $self->{_thread} =~ /Thread/); +} #------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/Post/Thread.pm b/lib/WebGUI/Asset/Post/Thread.pm index 01d1bc773..cb555d1e8 100644 --- a/lib/WebGUI/Asset/Post/Thread.pm +++ b/lib/WebGUI/Asset/Post/Thread.pm @@ -238,13 +238,12 @@ and next threads, and to delete the parent CS. =cut -override DESTROY => sub { - my $self = shift; - return undef unless defined $self; - $self->{_next}->DESTROY if (defined $self->{_next}); - $self->{_previous}->DESTROY if (defined $self->{_previous}); - super(); -}; +sub DEMOLISH { + my $self = shift; + return undef unless defined $self; + $self->{_next}->DESTROY if (defined $self->{_next}); + $self->{_previous}->DESTROY if (defined $self->{_previous}); +} #------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm b/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm index 75a18c667..c0ed7a479 100644 --- a/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm +++ b/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm @@ -312,7 +312,7 @@ Destroy the cached assets =cut -sub DESTROY { +sub DEMOLISH { my $self = shift; for my $key ( qw/ _nextAlbum _prevAlbum / ) { my $asset = delete $self->{ $key };