[Rt-commit] r9751 - rt/branches/3.7-RTIR-RELENG/lib/RT
ruz at bestpractical.com
ruz at bestpractical.com
Tue Nov 27 17:20:49 EST 2007
Author: ruz
Date: Tue Nov 27 17:20:47 2007
New Revision: 9751
Modified:
rt/branches/3.7-RTIR-RELENG/lib/RT/User_Overlay.pm
Log:
* don't cache PrincipalObj. it causes memory leak as now
RT::CurrentUser ISA RT::User
Modified: rt/branches/3.7-RTIR-RELENG/lib/RT/User_Overlay.pm
==============================================================================
--- rt/branches/3.7-RTIR-RELENG/lib/RT/User_Overlay.pm (original)
+++ rt/branches/3.7-RTIR-RELENG/lib/RT/User_Overlay.pm Tue Nov 27 17:20:47 2007
@@ -1105,20 +1105,20 @@
my $self = shift;
unless ( $self->id ) {
- $RT::Logger->error('User not found');
- return;
+ $RT::Logger->error("Couldn't get principal for not loaded object");
+ return undef;
}
- unless ( $self->{'PrincipalObj'} ) {
- my $obj = RT::Principal->new( $self->CurrentUser );
- $obj->LoadById( $self->id );
- unless ( $obj->id && $obj->PrincipalType eq 'User' ) {
- $RT::Logger->crit( 'Wrong principal for user #'. $self->id );
- } else {
- $self->{'PrincipalObj'} = $obj;
- }
+ my $obj = RT::Principal->new( $self->CurrentUser );
+ $obj->LoadById( $self->id );
+ unless ( $obj->id ) {
+ $RT::Logger->crit( 'No principal for user #'. $self->id );
+ return undef;
+ } elsif ( $obj->PrincipalType ne 'User' ) {
+ $RT::Logger->crit( 'User #'. $self->id .' has principal of '. $obj->PrincipalType .' type' );
+ return undef;
}
- return $self->{'PrincipalObj'};
+ return $obj;
}
More information about the Rt-commit
mailing list