mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-12-24 02:01:42 +08:00
lib/Cxn.pm: Silence a warning (in 5.14)
I think this warning actually happens everywhere, but because of
how it happens, it gets masked by older versions of Perl.
Basically, Cxn's DESTROY method checks if $self->{dbh}, and if true,
calls ->disconnect on that. However, during global destruction --
when DESTROY is called -- you have no assurances that DESTROY
will be called before the dbh was already reaped.
This commit makes sure that the $self->{dbh} we have inside DESTROY
is actually a reference.
This commit is contained in:
@@ -193,7 +193,7 @@ sub name {
|
||||
|
||||
sub DESTROY {
|
||||
my ($self) = @_;
|
||||
if ( $self->{dbh} ) {
|
||||
if ( $self->{dbh} && ref($self->{dbh}) ) {
|
||||
PTDEBUG && _d('Disconnecting dbh', $self->{dbh}, $self->{name});
|
||||
$self->{dbh}->disconnect();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user