Hooking function when other addons are using local copies of it
I use an addon that calls hooksecurefunc on TaxiRequestEarlyLanding. I also use a UI addon that replaces the Blizzard button that actually calls that function. The UI is using a local copy of the function, so the hook is never called.
What's the correct way for this situation to be handled? ElvUI does the same thing as the UI that I use, so I assume using a local copy of the function is fine. How is an addon supposed to hook a function when other addons may not trigger the hook? |
Don't use a local copy.
Localizing a function provides a minor performance increase for functions called often, especially each frame. This function is single use when the user requests it during a flight, it's silly to localize it. |
Quote:
|
Oh, oops, I misread. I thought you were the one using a local copy. hooksecurefunc propagates local pointers as long as you hook before any localizations happen.
If you are in control of the addon that hooks, look into the UI addon and see where it localizes. It most likely localizes at file load, so you'll have to put a ! in front of your addon's folder name and toc file to make sure you load before the UI addon. If it localizes at PLAYER_LOGIN, you can hook anytime before that, such as file load or ADDON_LOADED. If it's not your add-on, suggest what I suggested to the authors, preferably getting the UI addon author to not localize. |
I asked the UI author and was told that hooking Blizzard's TaxiRequestEarlyLanding functionality explicitly should not carry over to the UI's button (which does the exact same thing and nothing else). Can't do much about that, unfortunately. Thanks for your time, I really appreciate it!
|
All times are GMT -6. The time now is 05:55 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI