Skip to content

Commit f3ac965

Browse files
committed
Use an atomic counter instead of steady_clock for the font name.
1 parent a2d93d9 commit f3ac965

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/renderer/base/FontResource.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ void FontResource::_regenerateFont()
133133
fontResource.dfBitsOffset = sizeof(FONTINFO);
134134
fontResource.dfFlags = DFF_FIXED | DFF_1COLOR;
135135

136-
// We use the steady_clock to create a unique name for the font.
137-
const auto uniqueValue = std::chrono::steady_clock::now().time_since_epoch().count();
138-
sprintf_s(fontResource.szFaceName, "WTSOFTFONT%016llX", uniqueValue);
136+
// We use an atomic counter to create a locally-unique name for the font.
137+
static std::atomic<uint64_t> faceNameCounter;
138+
sprintf_s(fontResource.szFaceName, "WTSOFTFONT%016llX", faceNameCounter++);
139139

140140
// Each character has a fixed size and position in the font bitmap, but we
141141
// still need to fill in the header table with that information.

0 commit comments

Comments
 (0)