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
|
end
|
||||||
|
|
||||||
local hookedFrames = {}
|
local hookedFrames = {}
|
||||||
|
local seenNaturalShow = {}
|
||||||
|
|
||||||
local function ApplySetting()
|
local function ApplySetting()
|
||||||
|
|
||||||
@@ -59,6 +60,7 @@ local function ApplySetting()
|
|||||||
if not hookedFrames[frameName] then
|
if not hookedFrames[frameName] then
|
||||||
|
|
||||||
frame:HookScript("OnShow", function(self)
|
frame:HookScript("OnShow", function(self)
|
||||||
|
seenNaturalShow[frameName] = true
|
||||||
local _, currentClass = UnitClass("player")
|
local _, currentClass = UnitClass("player")
|
||||||
if ShouldHideForClass(currentClass, frameName) then
|
if ShouldHideForClass(currentClass, frameName) then
|
||||||
self:Hide()
|
self:Hide()
|
||||||
@@ -73,7 +75,12 @@ local function ApplySetting()
|
|||||||
|
|
||||||
if hide then
|
if hide then
|
||||||
frame:Hide()
|
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()
|
frame:Show()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user