PLAYER_LOGIN issue?
Hi. There seems to be a situation where a slash command is being registered in ADDON_LOADED, and a frame upon which it relies is not being registered until PLAYER_LOGIN. So, in cases I cannot reproduce, someone is able to issue the slash command before the frame is created and crash.
Are there cases when ADDON_LOADED is called but PLAYER_LOGIN is not? I know PLAYER_ALIVE is not called upon UI reload (or at least this was the case prior to WoD). I am thinking I will just move the frame creation into ADDON_LOADED, but would like to know whether I can reproduce this before I do, just in case other things should be moved as well. |
PLAYER_LOGIN will always happen on UI load. (actual login and UI reload) If your addon is loaded on demand it might be loaded (as in ADDON_LOADED) when PLAYER_LOGIN has already happened, otherwise I'm pretty sure all non LoD addons will load before that.
Personally though, I always create frames in the main chunk, unless their creation is based on some saved variables. |
As each addon loads, WoW reads its TOC file, then loads all the files listed in its TOC in order (and any files listed in them, in case of XML files, also all in order), then loads its saved variables file(s) if it has any, and then fires an ADDON_LOADED event with the addon's folder name as the first and only argument.
All addons that are not configured to load on demand are loaded before PLAYER_LOGIN fires. Unless your addon is LOD or has a LoadManager, its ADDON_LOADED event will always fire before PLAYER_LOGIN. You should not use PLAYER_ALIVE or VARIABLES_LOADED or any other events to initialize your addon. If you are sure your addon is not load-on-demand and does not have a LoadManager, you can just do everything in PLAYER_LOGIN, since your ADDON_LOADED event will always fire before PLAYER_LOGIN. If you are not sure, or you are still having problems, here is a good fool-proof loading process that will work regardless of whether your addon is LOD or has a LoadManager, on both a /reload and on a fresh login: Code:
local ADDON_NAME = ... |
Quote:
|
All times are GMT -6. The time now is 11:11 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI