CODE:
dTHXc;
bool exists;
- SHARED_EDIT;
if (SvTYPE(SHAREDSvPTR(shared)) == SVt_PVAV) {
+ SHARED_EDIT;
exists = av_exists((AV*) SHAREDSvPTR(shared), SvIV(index));
}
else {
STRLEN len;
char *key = SvPV(index,len);
+ SHARED_EDIT;
exists = hv_exists((HV*) SHAREDSvPTR(shared), key, len);
}
SHARED_RELEASE;
use ExtUtils::testlib;
use strict;
-BEGIN { print "1..14\n" };
+BEGIN { print "1..15\n" };
use threads;
use threads::shared;
ok(1,1,"loaded");
ok(11, $seen{2} == 1, "Keys..");
ok(12, $seen{3} == 1, "Keys..");
ok(13, $seen{"foo"} == 1, "Keys..");
+
+# bugid #24407: the stringification of the numeric 1 got allocated to the
+# wrong thread memory pool, which crashes on Windows.
+ok(14, exists $hash{1}, "Check numeric key");
+
threads->create(sub { %hash = () })->join();
-ok(14, keys %hash == 0, "Check clear");
+ok(15, keys %hash == 0, "Check clear");