Guard forced Show() to frames already shown naturally by the game
This commit is contained in:
+8
-1
@@ -45,6 +45,7 @@ local function ShouldHideForClass(playerClass, frameName)
|
||||
end
|
||||
|
||||
local hookedFrames = {}
|
||||
local seenNaturalShow = {}
|
||||
|
||||
local function ApplySetting()
|
||||
|
||||
@@ -59,6 +60,7 @@ local function ApplySetting()
|
||||
if not hookedFrames[frameName] then
|
||||
|
||||
frame:HookScript("OnShow", function(self)
|
||||
seenNaturalShow[frameName] = true
|
||||
local _, currentClass = UnitClass("player")
|
||||
if ShouldHideForClass(currentClass, frameName) then
|
||||
self:Hide()
|
||||
@@ -73,7 +75,12 @@ local function ApplySetting()
|
||||
|
||||
if hide then
|
||||
frame:Hide()
|
||||
else
|
||||
elseif seenNaturalShow[frameName] then
|
||||
-- The server never Show()s a frame the current class doesn't use,
|
||||
-- so its data (powerType, maxValue, ...) is never populated. Forcing
|
||||
-- Show() on it exposes that uninitialized state and crashes the
|
||||
-- server's own OnUpdate handler. Only force-show a frame we've
|
||||
-- already seen the game display naturally at least once.
|
||||
frame:Show()
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user