HizurosWoWAddOns / LibDropDownMenu

GNU General Public License v3.0
1 stars 1 forks source link

[BUG]: Error since latest release (r37) #3

Open zaphon opened 8 months ago

zaphon commented 8 months ago

WoW client

WoW Retail

What happened?

I have several addons that import the LibDropDownMenu library, and one of them a few days ago updated to r37. The others are at r36. Since doing so, when I attempt to right click on the LDB icon for WIM (which imports LibDropDownMenu), I get the following error.

NOTE: I installed LibDropDownMenu by it's self to ensure that it was the AddOn.

If I roll back to r36 (which involves replacing it within the AddOn that updated to r37 (DBM-Core for me)), everything is fine. Looking at the diffs between r36 and r37, it's mostly around this NewFeature functionality which it's claiming in this case is nil. I've read through the code and honestly not sure how it's nil (I even tried to force it to initialize it in the function that this is failing in), but here we are. I'm going to keep rolling back to r36 for now, but wanted you to be aware (and this is going to become more difficult as more AddOns I have update their libraries).

Lua Error Message?

1x LibDropDownMenu-37/LibDropDownMenu.lua:794: attempt to index field 'NewFeature' (a nil value)
[string "@LibDropDownMenu-37/LibDropDownMenu.lua"]:794: in function <LibDropDownMenu/LibDropDownMenu.lua:497>
[string "@WIM/Sources/ContextMenu.lua"]:119: in function `initFunction'
[string "@LibDropDownMenu-37/LibDropDownMenu.lua"]:138: in function <LibDropDownMenu/LibDropDownMenu.lua:130>
[string "@WIM/Sources/ContextMenu.lua"]:142: in function `PopContextMenu'
[string "@WIM/Modules/ldb.lua"]:41: in function `OnClick'
[string "@ChocolateBar/Chocolate.lua"]:298: in function <ChocolateBar/Chocolate.lua:295>

Other addons?

No response

hizuro commented 8 months ago

Thank you for reporting. That was a result of different version of this lib at the same time. r38 should fix this problem. Update coming soon.

Greetings Hizuro

zaphon commented 8 months ago

I picked up r38 (which is funny as what you did was what I had actually done trying to fix it). I still get the same error (just the line number moved 1).

I took a look at the Update_DropDownMenuButton() function, and IMO that compare on the second line exiting seems backwards (the not seems out of place, I think you're saying if it already exists, leave), but I removed the not (heck I even commented the entire line out), and I still get the error.

That's why I said I am not sure how the heck this thing is nil!

2x LibDropDownMenu-38/LibDropDownMenu.lua:795: attempt to index field 'NewFeature' (a nil value)
[string "@LibDropDownMenu-38/LibDropDownMenu.lua"]:795: in function <LibDropDownMenu/LibDropDownMenu.lua:497>
[string "@WIM/Sources/ContextMenu.lua"]:119: in function `initFunction'
[string "@LibDropDownMenu-38/LibDropDownMenu.lua"]:138: in function <LibDropDownMenu/LibDropDownMenu.lua:130>
[string "@WIM/Sources/ContextMenu.lua"]:142: in function `PopContextMenu'
[string "@WIM/Modules/ldb.lua"]:41: in function `OnClick'
[string "@ChocolateBar/Chocolate.lua"]:298: in function <ChocolateBar/Chocolate.lua:295>
zaphon commented 8 months ago

Actually there's something funky going on with the way different versions of the addon load / interact with each other. I know the LibStub behavior works for the main LUA file, but not sure what (if anything) it's doing for the additional files. As a test, I replaced the LibDropDownMenu files in the 3 addons I have with it and it's working now.

Broker_Everything (I think that's yours, it was at r35 I believe) DBM-Core (r37) WIM (r36)

And while I loaded LibDropDownMenu (r38) as it's own AddOn, it was still misbehaving. But as soon as I put all the files for r38 into every addon above (so they're all at r38 now). Works fine.

I had also tried moving the addon to !LibDropDownMenu and even ZZLibDropDownMenu to figure out what was going on (including adding prints into the Update_DropDownMenuButton() function which is how I knew it wasn't getting called in the main AddOn (it appears it was calling the one in the r37 version of the addon loaded by DBM-Core as that function existed there as well)). So as I said, things aren't working as expected (every other library I looked at that uses the LibStub functionality to handle loading the latest version only has a single LUA file, you're loading 4)

I'm far from a wow addon expert, so I'll leave it to you to ponder this situation (pretty easy to recreate my environment, all the addons above are the latest versions, and unfortunately most addons no longer ship with a -nolibs version like they did in the old days).