diff --git a/HideCoA.lua b/HideCoA.lua index 2f50bf6..67ae23b 100644 --- a/HideCoA.lua +++ b/HideCoA.lua @@ -161,24 +161,17 @@ HideCoA.ResetProfile = ResetProfile local function DeleteProfile(name) - if name == "Default" then - return - end - - local wasActive = (name == GetActiveProfileName()) - HideCoADB.profiles[name] = nil for charKey, assigned in pairs(HideCoADB.charProfile) do if assigned == name then + -- Unassigning falls back to the character's own auto-created + -- profile (see GetActiveProfileName/GetActiveClassSettings), + -- which gets recreated on demand if it doesn't exist. HideCoADB.charProfile[charKey] = nil end end - if wasActive then - HideCoADB.charProfile[GetCharacterKey()] = "Default" - end - end HideCoA.DeleteProfile = DeleteProfile @@ -362,18 +355,11 @@ f:SetScript("OnEvent", function(self, event, arg1) end -- Legacy pre-profile saved variables stored a single flat classSettings - -- table shared by every character. Fold it into "Default" so nobody's - -- existing hide/show choices vanish when profiles were introduced. - if HideCoADB.classSettings and not HideCoADB.profiles["Default"] then - HideCoADB.profiles["Default"] = { classSettings = HideCoADB.classSettings } - end - + -- table shared by every character. Fold it into whichever character + -- happens to load next so those hide/show choices don't just vanish. + local legacyFlatClassSettings = HideCoADB.classSettings HideCoADB.classSettings = nil - if not HideCoADB.profiles["Default"] then - HideCoADB.profiles["Default"] = { classSettings = CreateDefaultClassSettings() } - end - local charKey = GetCharacterKey() -- The profile-name syntax used to be "realm - character"; rename any @@ -407,7 +393,7 @@ f:SetScript("OnEvent", function(self, event, arg1) end if not HideCoADB.profiles[charKey] then - HideCoADB.profiles[charKey] = { classSettings = CreateDefaultClassSettings() } + HideCoADB.profiles[charKey] = { classSettings = legacyFlatClassSettings or CreateDefaultClassSettings() } end for name, profile in pairs(HideCoADB.profiles) do