diff --git a/modules/Bio/EnsEMBL/Translation.pm b/modules/Bio/EnsEMBL/Translation.pm index ab2ef34de0dcf376f6b8affc48c9a34f9759895f..148409f9a0e49811e1dbda774cdb38d14d0145d1 100755 --- a/modules/Bio/EnsEMBL/Translation.pm +++ b/modules/Bio/EnsEMBL/Translation.pm @@ -52,6 +52,8 @@ package Bio::EnsEMBL::Translation; use vars qw($AUTOLOAD @ISA); use strict; +use Scalar::Util qw(weaken); + use Bio::EnsEMBL::Utils::Exception qw( deprecate throw warning ); use Bio::EnsEMBL::Utils::Argument qw( rearrange ); @@ -144,6 +146,8 @@ sub transcript { $self->{'transcript'} = $transcript; + weaken($self->{'transcript'}); + } elsif ( !defined( $self->{'transcript'} ) ) { my $adaptor = $self->{'adaptor'}; if ( !defined($adaptor) ) { @@ -158,6 +162,8 @@ sub transcript { $self->{'transcript'} = $adaptor->db()->get_TranscriptAdaptor() ->fetch_by_translation_id($dbID); + + weaken($self->{'transcript'}); } return $self->{'transcript'};