WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Disabled AddOn's hooks still ... hooked? (https://www.wowinterface.com/forums/showthread.php?t=55752)

myrroddin 09-20-17 03:37 AM

Disabled AddOn's hooks still ... hooked?
 
I am writing a plugin for ElvUI that hooks the function that displays the text on the xp, honor, rep, and artifact bars; in and of itself it works totally fine. When it is enabled via its own settings, it does its job. When the toggle off is set, it reverts the text back to the original text because I call the ElvUI's function again.

I thought that would be the end of it, but since I am still writing the thing, I disabled it entirely via the game's AddOns button last night when raiding. In other words, my AddOn was not even loaded.

So imagine my surprise when my replacement text for the XP bar still was intact! ElvUI does not support the text I have added. No, this is some kind of legacy of an entirely disabled AddOn. How in the world is that even possible?!?

Anyone have any ideas why a disabled AddOn would still be functional? The only clue I have is that once disabled via the AddOn button (technically ACP's button version) and switching AddOn profile setups, I needed to reload the UI, which of course I did.

Shouldn't that mean my AddOn is removed from memory, its functions disabled, and its hooks turned off?

jeffy162 09-20-17 07:38 AM

Ye-e-e-ah, apparently it doesn't. I discovered this happening to me (but not with an addon that I'd written - I don't write addons, y'know) several years ago. I was doing ... something (sorry, can't remember what) ... and I had disabled certain addons, but, low and behold - there they were! I found out that to TRULY disable them, I had to disable the addons and restart my computer, THEN they were disabled.

I figured that it was just a glitch or it was something with the system. I don't know, but, it happened several times. I finally gave up trying to do whatever it was 'cause it was just too much of a p-i-t-a.

semlar 09-20-17 01:17 PM

A /reload resets the interface to its initial state; regardless of what your addon does, if you've properly disabled it and reloaded your ui it will not be doing it any more. The only exception to this is persistent CVars and saved variables being loaded by other addons.

Either your addon was not actually disabled, you didn't reload the game, or you're mistaking its effect with one from another addon.

myrroddin 09-20-17 06:33 PM

Quote:

Originally Posted by semlar (Post 325224)
The only exception to this is persistent CVars and saved variables being loaded by other addons.

Either your addon was not actually disabled, you didn't reload the game, or you're mistaking its effect with one from another addon.

Here's where I'm confused. Just like Jeffy, I disabled my module plugin via Esc - AddOns, then reloaded my UI. My code has nothing to do with CVars, and it does add to ElvUI's SV table, the option is a toggle. I understand that the toggle would still be in Elv's SV table, but it should not do anything with my module turned off and the UI reloaded.

In pseudocode because pasting my entire module's code is long, here's what happens.
Lua Code:
  1. -- Elv enabled, MyModule not installed
  2. bar:SetText("3 / 71")
  3.  
  4. -- Elv enabled, MyModule installed and enabled
  5. bar:SetText("Capped")
  6.  
  7. -- Elv enabled, MyModule installed but disabled via its own options menu
  8. bar:SetText("3 / 71")
  9.  
  10. -- Elv enabled, MyModule installed, enabled as per #2 above, then disabled via Esc - AddOns
  11. -- MyModule's toggle still set to true
  12. bar:SetText("Capped")

Just because MyModule's toggle is set to true should not do anything if there is no function to handle the toggle.

Now you know why I am confused about hooking functions. If MyModule is not even loaded and the UI has been reloaded, then why hasn't bar's text reverted back to pre-MyModule display?

And for the record, I have no other addons that change bar's text to "Capped", hence why among other reasons, I am writing the module. Only MyModule changes the text to "Capped" via secure hook.

ElvUI cannot call MyModule's function that changes the text if MyModule is not even loaded.... :confused:

Seerah 09-20-17 07:23 PM

As semlar stated, this is not possible. If there were a bug where the game wasn't flushing the UI on reload, I would think that it would have been discovered by now.

Even the default UI gets rebuilt on a reload.


All times are GMT -6. The time now is 09:32 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI