[Jifty-commit] r6974 - Jifty-DBI/trunk/lib/Jifty/DBI
Jifty commits
jifty-commit at lists.jifty.org
Mon May 11 14:29:58 EDT 2009
Author: alexmv
Date: Mon May 11 14:29:58 2009
New Revision: 6974
Modified:
Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm
Log:
Use eval {} in Jifty::DBI::Handle's DESTROY block when manipulating DBI
Alterations to the DBI object in the DESTROY block must be wrapped in
an eval {}, as object destruction order is not guaranteed during
global destruction, and this interacts poorly with DBI's tie'd object.
Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm (original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm Mon May 11 14:29:58 2009
@@ -1328,7 +1328,13 @@
sub DESTROY {
my $self = shift;
- $self->disconnect unless $self->dbh and $self->dbh->{InactiveDestroy};
+ $self->disconnect
+ unless $self->dbh
+ and $self->dbh
+ # We use an eval {} because DESTROY order during
+ # global destruction is not guaranteed -- the dbh may
+ # no longer be tied, which throws an error.
+ and eval { $self->dbh->{InactiveDestroy} };
delete $DBIHandle{$self};
}
More information about the Jifty-commit
mailing list