Module's OnDisable functions don't get called after state being set in OnInitialize function of the AddOn. #432


Closed
  • Layback_ created this issue Dec 27, 2017

    Hi Ace3,

     

    First of all, I apologize if I'm on a wrong spot to ask regarding this.

     

    After reading a description on AceAddon-3.0.lua file, I couldn't figure out why my module's OnEnable/OnDisable functions not being called and thus I've reached here.

     

    Please have a look at the following codes first.

     

    init.lua: https://pastebin.com/z1CRRD0j

    Assassination.lua: https://pastebin.com/74HcbZk6

     

    ADDED WITH AN EDIT

    Outlaw.lua: https://pastebin.com/cZi32PDp

    Subtlety.lua: https://pastebin.com/Z4UUCVpC

     

    As you can see, I'm manually calling E:ACTIVE_TALENT_GROUP_CHANGED function with an extra parameter called isOnInitialize to pre-set modules enabledState based on player's current specialization. To be honest, they are being set properly and I thought they would call either of OnEnable or OnDisable function, but it didn't... PLEASE REFER TO EDIT

     

    Even after reading a documentation I couldn't get why...

     

    Would this be an intended behaviour? If so... could you please tell me why and how I could solve this case?

     

    Thank you.

     

    EDIT: The initial test was done without modules for assassination and subtlety being created. So, guess I should correct an error. It seems like OnEnable function is successfully being called for the one that is enabled, as I expected. However, the other two modules' OnDisable functions still don't get called on addon's OnInitialize function.

     

    EDIT2: On Specialization change, only the old spec's OnDisable function and new spec's OnEnable function get called (no affects on third spec). Would this be an intended behavior?

     

    EDIT3: I've done further experiment and figured that even if I set an addon's default module state to false, it doesn't call OnDisable function on initialization phase. Does this mean that I have to manually call OnDisable function if needed during the initialization?

  • Layback_ edited title and description Dec 27, 2017
  • Layback_ edited description Dec 27, 2017
  • Layback_ edited description Dec 28, 2017
  • Layback_ edited description Dec 28, 2017
  • nevcairiel posted a comment Jan 3, 2018

    OnDisable is only called when a module was previously enabled. If a module is never scheduled for being enabled (because its initial state is disabled), then neither OnEnable or OnDisable will ever be invoked - intentionally so.

  • nevcairiel closed issue May 2, 2018

To post a comment, please login or register a new account.