fix(AceDB): backport PR #10 — falsy defaults read back as themselves

Upstream AceDB-3.0's simple-value defaults metatable uses
`function(t,k2) return k2~=nil and v or nil end` — when `v` is itself
falsy (`false`, `0`, `""`), the `and` short-circuits to that falsy
value and the trailing `or nil` then collapses it to nil, so any
`['*'] = false` (or similar) default silently reads back as nil.

Backport of https://github.com/WoWUIDev/Ace3/pull/10 (open upstream since
2023-11-04, not merged). Documented as CoA-compat patch #4 in README;
drop it when upstream finally merges.
This commit is contained in:
2026-05-24 19:30:28 +02:00
parent 3ec2009f54
commit 9583952806
2 changed files with 10 additions and 1 deletions
+1
View File
@@ -15,6 +15,7 @@ can't quietly regress when one of them is disabled.
| 1 | Upstream Ace3 calls `Texture:Set*Texture(<FileDataID>)` with numeric FileDataIDs in 42 places across `AceGUI-3.0/widgets/*` and `AceConfigDialog-3.0`. FileDataIDs are a retail-only API (post WoD/Legion). On the WoW 3.3.5-based CoA client, `SetTexture` only accepts string paths — passing a number silently fails and the engine renders a red placeholder. Symptom: solid-red squares where color swatches / checkboxes / window chrome should be. | Each FDID call was substituted with the string path that already lived in the trailing comment, e.g. `colorSwatch:SetTexture(130939)``colorSwatch:SetTexture("Interface\\ChatFrame\\ChatFrameColorSwatch")`. |
| 2 | `AceGUI-3.0/widgets/AceGUIContainer-BlizOptionsGroup.lua` Constructor parents its frame to the global `InterfaceOptionsFramePanelContainer`. On the CoA reworked FrameXML that global is nil at AceGUI widget-construction time, and `CreateFrame("Frame", nil, nil)` is fine, but downstream code that calls `:SetPoint` against the parent / `:Show` it via the options tree relies on a real parent. Symptom: every addon that registers a Blizzard Interface Options panel via AceConfigDialog errors during load. | Guard at line 102: `local _parent = InterfaceOptionsFramePanelContainer or UIParent` and pass `_parent` to `CreateFrame`. Widget behaviour is unchanged on retail; on CoA the panel parents to `UIParent` so the rest of the widget works. |
| 3 | `AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua` `:AddToBlizOptions` uses the Dragonflight+ `Settings.*` API (`Settings.GetCategory`, `Settings.RegisterCanvasLayoutCategory`, `Settings.RegisterCanvasLayoutSubcategory`, `Settings.RegisterAddOnCategory`). The `Settings` table doesn't exist on the 3.3.5-based CoA client, so every AceConfig-driven options panel errors out the moment it's registered. | Wrap the whole `Settings.*` block in `if Settings and Settings.GetCategory then … else … end`. The `else` branch falls back to the WotLK-era `InterfaceOptions_AddCategory(group.frame)` after stamping the category name via `group:SetName(name or appName, parent)`. |
| 4 | `AceDB-3.0/AceDB-3.0.lua:114` — the simple-value `__index` metatable for defaults is `function(t,k2) return k2~=nil and v or nil end`. Whenever the default value `v` is itself falsy (`false`, `0`, `""`), the `and` short-circuits and the `or nil` resolves to `nil`, so `["*"] = false` and similar falsy defaults are silently lost when read. | Replaces the one-liner with an explicit `if k2 == nil then return nil end; return v` so falsy defaults round-trip correctly. Backport of [WoWUIDev/Ace3 PR #10](https://github.com/WoWUIDev/Ace3/pull/10) (open since 2023-11-04, not merged upstream). Drop this patch if/when upstream merges. |
## Versions