Skip to content

Commit cffa033

Browse files
zadjii-msftDHowett
authored andcommitted
When we reload a profile, always use the same GUID for it (#2542)
This ensures that settings reload works for profiles w/o GUIDs
1 parent ebcf812 commit cffa033

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/cascadia/TerminalApp/Profile.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,10 @@ Profile Profile::FromJson(const Json::Value& json)
357357
}
358358
else
359359
{
360-
result._guid = Utils::CreateGuid();
360+
// Always use the name to generate the temporary GUID. That way, across
361+
// reloads, we'll generate the same static GUID.
362+
const std::wstring_view name = result._name;
363+
result._guid = Utils::CreateV5Uuid(RUNTIME_GENERATED_PROFILE_NAMESPACE_GUID, gsl::as_bytes(gsl::make_span(name)));
361364

362365
TraceLoggingWrite(
363366
g_hTerminalAppProvider,

src/cascadia/TerminalApp/Profile.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Author(s):
1616
#pragma once
1717
#include "ColorScheme.h"
1818

19+
// GUID used for generating GUIDs at runtime, for profiles that did not have a
20+
// GUID specified manually.
21+
constexpr GUID RUNTIME_GENERATED_PROFILE_NAMESPACE_GUID = { 0xf65ddb7e, 0x706b, 0x4499, { 0x8a, 0x50, 0x40, 0x31, 0x3c, 0xaf, 0x51, 0x0a } };
22+
1923
namespace TerminalApp
2024
{
2125
class Profile;

0 commit comments

Comments
 (0)