Skip to content

Commit 4cb1c33

Browse files
committed
The runtime entry points for enabling/disabling a dynamic replacement scope also must hold the lock
1 parent 4270bdd commit 4cb1c33

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

stdlib/public/runtime/MetadataLookup.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,12 +1645,14 @@ void swift::addImageDynamicReplacementBlockCallback(
16451645
[&] { automaticReplacements->enableReplacements(); });
16461646
}
16471647

1648-
void swift::swift_enableDynamicReplacementScope(const DynamicReplacementScope *scope) {
1649-
scope->enable();
1648+
void swift::swift_enableDynamicReplacementScope(
1649+
const DynamicReplacementScope *scope) {
1650+
DynamicReplacementLock.get().withLock([=] { scope->enable(); });
16501651
}
16511652

1652-
void swift::swift_disableDynamicReplacementScope(const DynamicReplacementScope *scope) {
1653-
scope->disable();
1653+
void swift::swift_disableDynamicReplacementScope(
1654+
const DynamicReplacementScope *scope) {
1655+
DynamicReplacementLock.get().withLock([=] { scope->disable(); });
16541656
}
16551657
#define OVERRIDE_METADATALOOKUP COMPATIBILITY_OVERRIDE
16561658
#include "CompatibilityOverride.def"

0 commit comments

Comments
 (0)