Thread Tools Display Modes
09-20-17, 03:37 AM   #1
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
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?
  Reply With Quote
09-20-17, 07:38 AM   #2
jeffy162
A Pyroguard Emberseer
 
jeffy162's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 2,364
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.
__________________
Ahhhh, the vagueries of the aging mind. Wait.... What was I saying?


Carbonite <----- GitHub main module (Maps ONLY) download link. The other modules are also available on GitHub.
Carbonite-CLASSIC<----- GitHub link to Carbonite Classic. Thanks to ircdirk for this!
  Reply With Quote
09-20-17, 01:17 PM   #3
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
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.
  Reply With Quote
09-20-17, 06:33 PM   #4
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
Originally Posted by semlar View Post
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....
  Reply With Quote
09-20-17, 07:23 PM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
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.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Disabled AddOn's hooks still ... hooked?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off