Skip to content

Commit

Permalink
Item14152: Fixed attempt to use undef app attribute at cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
vrurg committed Jun 17, 2017
1 parent 91fcf50 commit 66d0507
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
4 changes: 2 additions & 2 deletions core/lib/Foswiki/App.pm
Expand Up @@ -113,7 +113,7 @@ has extMgr => (
is => 'ro',
lazy => 1,
clearer => 1,
builder => '_prepareExtMgr',
builder => 'prepareExtMgr',
);
has forms => (
is => 'ro',
Expand Down Expand Up @@ -1572,7 +1572,7 @@ sub _prepareUser {
return undef;
}

sub _prepareExtMgr {
sub prepareExtMgr {
my $this = shift;

# Don't use create() here because the latter depends on extensions.
Expand Down
21 changes: 15 additions & 6 deletions core/lib/Foswiki/Aux/Callbacks.pm
Expand Up @@ -98,14 +98,23 @@ around BUILD => sub {

before DEMOLISH => sub {
my $this = shift;

#$this->_traceMsg("Callbacks DEMOLISH");
my ($in_global) = @_;

# Cleanup all callbacks registed by this object.
my $appHeap = $this->_getApp->heap;

foreach my $cbName ( keys %{ $appHeap->{_aux_registered_callbacks} } ) {
$this->deregisterCallback($cbName);
unless ($in_global) {
my $app = $this->_getApp;

# The application object could have been already destroyed at this
# moment. This is normal for auto-destruction.
if ( defined $app ) {
my $appHeap = $app->heap;

foreach
my $cbName ( keys %{ $appHeap->{_aux_registered_callbacks} } )
{
$this->deregisterCallback($cbName);
}
}
}
};

Expand Down

0 comments on commit 66d0507

Please sign in to comment.