From 003430b5ad734dd8b42527ad019c27fb1edb7e1e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Tue, 8 Oct 2019 14:39:42 +0200
Subject: [PATCH] Testsuite [Thread.ResourceCount]: Improved robustness.

In general objects are not guaranteed to get destructed
immediately on losing their references, so destruct the
ResourceCountKey explicitly.

NB: In Pike 7.1 and later ResourceCountKey inherits
    Pike.DestructImmediate, and thus will get immediate
    destruction.
---
 lib/modules/testsuite.in | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/modules/testsuite.in b/lib/modules/testsuite.in
index 2b0e6de71c..d65b5670e1 100644
--- a/lib/modules/testsuite.in
+++ b/lib/modules/testsuite.in
@@ -2099,6 +2099,9 @@ test_any_equal([[
     a[i] = TestResourceCount->acquire();
   }
   for(i = 0; i < 10; i++) {
+    // Make sure that the object is destructed properly before
+    // we call drained().
+    destruct(a[i]);
     a[i] = 0;
     a[i] = TestResourceCount->drained();
   }
-- 
GitLab