mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-26 09:26:02 +00:00
crash fix by jrc13245
- This possibily fixes a rare unitxp crash on logout. Credits go to: jrc13245
This commit is contained in:
+17
-1
@@ -123,12 +123,25 @@ combo:SetScript("OnEvent", function()
|
||||
hascombopoints = GetComboPoints() > 0
|
||||
end)
|
||||
|
||||
-- Flag to prevent UnitXP calls during logout (crash prevention)
|
||||
local librange_isLoggingOut = false
|
||||
|
||||
librange:Hide()
|
||||
librange:RegisterEvent("ACTIONBAR_SLOT_CHANGED")
|
||||
librange:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
librange:RegisterEvent("PLAYER_ENTER_COMBAT")
|
||||
librange:RegisterEvent("PLAYER_LEAVE_COMBAT")
|
||||
librange:RegisterEvent("PLAYER_LOGOUT")
|
||||
librange:RegisterEvent("PLAYER_LEAVING_WORLD")
|
||||
librange:SetScript("OnEvent", function()
|
||||
-- Handle logout to prevent UnitXP crashes during shutdown
|
||||
if event == "PLAYER_LOGOUT" or event == "PLAYER_LEAVING_WORLD" then
|
||||
librange_isLoggingOut = true
|
||||
this:SetScript("OnUpdate", nil) -- Stop OnUpdate completely
|
||||
this:Hide()
|
||||
return
|
||||
end
|
||||
|
||||
-- disable range checking activities
|
||||
if pfUI_config.unitframes.rangecheck == "0" or not spells[class] then
|
||||
this:Hide()
|
||||
@@ -156,6 +169,9 @@ local target_event = TargetFrame_OnEvent
|
||||
local target_nop = function() return end
|
||||
|
||||
librange:SetScript("OnUpdate", function()
|
||||
-- Prevent UnitXP calls during logout (crash prevention)
|
||||
if librange_isLoggingOut then return end
|
||||
|
||||
if ( this.tick or 1) > GetTime() then
|
||||
return
|
||||
else
|
||||
@@ -301,4 +317,4 @@ function librange:UnitInSpellRange(unit)
|
||||
end
|
||||
|
||||
-- add librange to pfUI API
|
||||
pfUI.api.librange = librange
|
||||
pfUI.api.librange = librange
|
||||
Reference in New Issue
Block a user