Skip to content
Snippets Groups Projects
Commit 4fb569e1 authored by Andreas Kusalananda Kähäri's avatar Andreas Kusalananda Kähäri
Browse files

Make the reference from the Translation to its Transcript weak using

Scalar::Util::weaken() to avoid memory leak.
parent ed2c1c89
No related branches found
No related tags found
No related merge requests found
......@@ -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'};
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment