Skip to content

Commit

Permalink
Item14237: Merge commit '66d050726f5daac96d7f60e9b8d8eb9b97226935' in…
Browse files Browse the repository at this point in the history
…to Item14237

* commit '66d050726f5daac96d7f60e9b8d8eb9b97226935':
  Item14152: Fixed attempt to use undef app attribute at cleanup.
  • Loading branch information
vrurg committed Jun 17, 2017
2 parents 2d4c397 + 66d0507 commit 414f7c8
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions core/lib/Foswiki/Aux/Callbacks.pm
Original file line number Diff line number Diff line change
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 414f7c8

Please sign in to comment.