From cffa0331166446e08c8eb7af298c5409a545115d Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Mon, 26 Aug 2019 12:21:30 -0500 Subject: [PATCH] When we reload a profile, always use the same GUID for it (#2542) This ensures that settings reload works for profiles w/o GUIDs --- src/cascadia/TerminalApp/Profile.cpp | 5 ++++- src/cascadia/TerminalApp/Profile.h | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cascadia/TerminalApp/Profile.cpp b/src/cascadia/TerminalApp/Profile.cpp index 5cd57f8a855..5863c3aae38 100644 --- a/src/cascadia/TerminalApp/Profile.cpp +++ b/src/cascadia/TerminalApp/Profile.cpp @@ -357,7 +357,10 @@ Profile Profile::FromJson(const Json::Value& json) } else { - result._guid = Utils::CreateGuid(); + // Always use the name to generate the temporary GUID. That way, across + // reloads, we'll generate the same static GUID. + const std::wstring_view name = result._name; + result._guid = Utils::CreateV5Uuid(RUNTIME_GENERATED_PROFILE_NAMESPACE_GUID, gsl::as_bytes(gsl::make_span(name))); TraceLoggingWrite( g_hTerminalAppProvider, diff --git a/src/cascadia/TerminalApp/Profile.h b/src/cascadia/TerminalApp/Profile.h index 7b1627ab08a..990bbc728c0 100644 --- a/src/cascadia/TerminalApp/Profile.h +++ b/src/cascadia/TerminalApp/Profile.h @@ -16,6 +16,10 @@ Author(s): #pragma once #include "ColorScheme.h" +// GUID used for generating GUIDs at runtime, for profiles that did not have a +// GUID specified manually. +constexpr GUID RUNTIME_GENERATED_PROFILE_NAMESPACE_GUID = { 0xf65ddb7e, 0x706b, 0x4499, { 0x8a, 0x50, 0x40, 0x31, 0x3c, 0xaf, 0x51, 0x0a } }; + namespace TerminalApp { class Profile;