From: Peter Rabbitson <ribasushi@cpan.org>
Date: Thu, 4 Feb 2016 09:30:30 +0000 (+0100)
Subject: Silence more spurious warnings (this one is a serious wtf)
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7e1774f762f0290fae3f9f9104a5d5dc52a1c017;p=dbsrgits%2FDBIx-Class.git

Silence more spurious warnings (this one is a serious wtf)

Seen in no-XS CI (e.g https://travis-ci.org/dbsrgits/dbix-class/jobs/106811389)
on all perls and too involved to diagnose properly given the tight schedule

Just go for a cop out
---

diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm
index d390dc6..cdfc942 100644
--- a/lib/DBIx/Class/Storage/DBI.pm
+++ b/lib/DBIx/Class/Storage/DBI.pm
@@ -901,7 +901,24 @@ sub disconnect {
     #$self->_sql_maker(undef); # this may also end up being different
   };
 
-  if( $self->_dbh ) {
+  # FIXME FIXME FIXME
+  # Something is wrong with CAG - it seems to delay GC in PP mode
+  # If the below if() is changed to:
+  #
+  #   if( $self->_dbh ) {
+  #
+  # The the following will reproducibly warn as the weakref in a $txn_guard
+  # is *NOT* deallocated by the time the $txn_guard destructor runs at
+  # https://github.com/dbsrgits/dbix-class/blob/84efb6d7/lib/DBIx/Class/Storage/TxnScopeGuard.pm#L82
+  #
+  # perl -Ilib -e '
+  #   BEGIN { warn $ENV{CAG_USE_XS} = ( time % 2 ) };
+  #   use DBIx::Class::Schema;
+  #   my $s = DBIx::Class::Schema->connect("dbi:SQLite::memory:");
+  #   my $g = $s->txn_scope_guard;
+  #   $s->storage->disconnect
+  # '
+  if( $self->{_dbh} ) { # do not use accessor - see above
 
     $self->_do_connection_actions(disconnect_call_ => $_) for (
       ( $self->on_disconnect_call || () ),