You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2016/06/14 11:28:28 UTC

lucy-clownfish git commit: Fix segfaults in Perl tests

Repository: lucy-clownfish
Updated Branches:
  refs/heads/master c7be35b8b -> f8dd6b938


Fix segfaults in Perl tests

During global destruction, Clownfish destructors can be invoked
forcefully in a random order. Circular references in Clownfish objects
must be broken to avoid segfaults.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/f8dd6b93
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/f8dd6b93
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/f8dd6b93

Branch: refs/heads/master
Commit: f8dd6b938912ddc403d591e836305cf05ecad1b0
Parents: c7be35b
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Tue Jun 14 12:13:46 2016 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Tue Jun 14 12:15:59 2016 +0200

----------------------------------------------------------------------
 runtime/perl/t/binding/016-vector.t |  7 +++++++
 runtime/perl/t/binding/017-hash.t   | 17 ++++++++++++-----
 2 files changed, 19 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f8dd6b93/runtime/perl/t/binding/016-vector.t
----------------------------------------------------------------------
diff --git a/runtime/perl/t/binding/016-vector.t b/runtime/perl/t/binding/016-vector.t
index 7f07a53..5069dcd 100644
--- a/runtime/perl/t/binding/016-vector.t
+++ b/runtime/perl/t/binding/016-vector.t
@@ -60,3 +60,10 @@ is(
 my $roundtripped = $vector->to_perl;
 is_deeply( $roundtripped, $arrayref, 'to_perl handles circular references');
 
+# During global destruction, Clownfish destructors can be invoked forcefully
+# in a random order. Circular references in Clownfish objects must be broken
+# to avoid segfaults.
+
+$hash->clear();
+$vector->clear();
+

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f8dd6b93/runtime/perl/t/binding/017-hash.t
----------------------------------------------------------------------
diff --git a/runtime/perl/t/binding/017-hash.t b/runtime/perl/t/binding/017-hash.t
index f2aefa7..1321f9f 100644
--- a/runtime/perl/t/binding/017-hash.t
+++ b/runtime/perl/t/binding/017-hash.t
@@ -56,13 +56,20 @@ is( $$hash, ${ $hash->fetch_raw('foo') },
 my $roundtripped = $hash->to_perl;
 is_deeply( $roundtripped, $hashref, 'to_perl handles circular references' );
 
-$hashref = { key => $hashref };
-$hash = to_clownfish($hashref);
-my $val = $hash->fetch_raw('key');
+my $deep_hashref = { key => $hashref };
+my $deep_hash = to_clownfish($deep_hashref);
+my $val = $deep_hash->fetch_raw('key');
 is( $$val, ${ $val->fetch_raw('bar')->fetch_raw(0) },
     'to_clownfish($hashref) handles deep circular references' );
 
-$roundtripped = $hash->to_perl;
-is_deeply( $roundtripped, $hashref,
+$roundtripped = $deep_hash->to_perl;
+is_deeply( $roundtripped, $deep_hashref,
            'to_perl handles deep circular references' );
 
+# During global destruction, Clownfish destructors can be invoked forcefully
+# in a random order. Circular references in Clownfish objects must be broken
+# to avoid segfaults.
+
+$hash->clear();
+$val->clear();
+