PLAYER_LOGIN callback taking too long, causing errors (potential fix included)
RofeTov opened this issue ยท 0 comments
The call to DoPopulationStuff() can time out if a player is loading many other plugins. This results in some frames not being created. In my case, backFrame15 and onward weren't getting created and isPopulated was never being set to true.
Here's a patch to make it only load when the Dragonrider window is shown (just-in-time).
diff --git a/DRJournal.lua b/DRJournal.lua
index 65825f8..9d31acb 100644
--- a/DRJournal.lua
+++ b/DRJournal.lua
@@ -998,7 +998,13 @@ end
function DR.mainFrame.Script_OnShow()
PlaySound(74421);
DR.mainFrame.Script_OnSizeChanged()
- DR.mainFrame.UpdatePopulation()
+
+ if DR.mainFrame.isPopulated then
+ DR.mainFrame.UpdatePopulation()
+ else
+ DR.mainFrame.DoPopulationStuff()
+ end
+
if DragonRider_DB.mainFrameSize ~= nil then
DR.mainFrame:SetSize(DragonRider_DB.mainFrameSize.width, DragonRider_DB.mainFrameSize.height);
end
diff --git a/DragonRider.lua b/DragonRider.lua
index 658ee19..e71e2cf 100644
--- a/DragonRider.lua
+++ b/DragonRider.lua
@@ -600,7 +600,6 @@ DR.EventsList:RegisterEvent("MOUNT_JOURNAL_USABILITY_CHANGED")
DR.EventsList:RegisterEvent("LEARNED_SPELL_IN_TAB")
DR.EventsList:RegisterEvent("PLAYER_CAN_GLIDE_CHANGED")
DR.EventsList:RegisterEvent("COMPANION_UPDATE")
-DR.EventsList:RegisterEvent("PLAYER_LOGIN")
DR.EventsList:RegisterEvent("CURRENCY_DISPLAY_UPDATE")
DR.EventsList:RegisterEvent("UPDATE_UI_WIDGET")
DR.EventsList:SetScript("OnEvent", function(self, event, ...)
@@ -1301,10 +1300,6 @@ function DR.EventsList:CURRENCY_DISPLAY_UPDATE(currencyID)
end
end
-function DR.EventsList:PLAYER_LOGIN()
- DR.mainFrame.DoPopulationStuff();
-end
-
function DR.OnAddonLoaded()
--[[ -- hiding code test
if event == "UPDATE_UI_WIDGET" then