From: Brandon L. Black Date: Wed, 9 Aug 2006 17:05:33 +0000 (+0000) Subject: backport the DBIx::Class::Storage::DBI::DESTROY fix for peopel sharing $dbh to other... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=89d794d486e3c73b489817059e9c3983deebde7f;p=dbsrgits%2FDBIx-Class-Historic.git backport the DBIx::Class::Storage::DBI::DESTROY fix for peopel sharing $dbh to other code --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 4158781..59f0357 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -1092,7 +1092,17 @@ sub build_datetime_parser { return $type; } -sub DESTROY { shift->disconnect } +sub DESTROY { + # NOTE: if there's a merge conflict here when -current is pushed + # back to trunk, take -current's version and ignore this trunk one :) + my $self = shift; + + if($self->_dbh && $self->_conn_pid != $$) { + $self->_dbh->{InactiveDestroy} = 1; + } + + $self->_dbh(undef); +} 1;