Kiatra / ChocolateBar

ChocolateBar is a World of Warcraft addons to display plugins in a bar on top or bottom of your screen
https://www.wowace.com/projects/chocolatebar
18 stars 9 forks source link

[Bug Report] CB_PlayedTime_Options fails to load on GetAddOnMetadata #31

Closed alberdingk-thijm closed 9 months ago

alberdingk-thijm commented 1 year ago

What game version did the bug occur in?

Wrath of the Lich King Classic

Troubleshooting

Describe the bug.

ChocolateBar throws an error when entering the game world when it attempts to load the module for CB_PlayedTime. This error occurs even if the PlayedTime module is not in use. When the PlayedTime module is in use, attempting to interact with its options also throws an error.

Based on the error, it seems that CB_PlayedTime_Options is not able to find CB_PlayedTime in the AddOn table. Perhaps it's due to a race condition?

Steps to reproduce.

  1. Enable the ChocolateBar addon.
  2. Enter the game world on any character. This error retriggers if you re-enter the world (e.g., after taking a portal or a boat).
  3. Enable the ChocolateBar PlayedTime module on a panel.
  4. Attempt to interact with the module via mouse click.

Expected behavior.

No error occurs.

Errors

15x ...ddOns/ChocolateBar/modules/CB_PlayedTime_Options.lua:5: bad argument #1 to 'GetAddOnMetadata' (Invalid AddOn name CB_PlayedTime. - Usage: local value = C_AddOns.GetAddOnMetadata(name, variable))
[string "=[C]"]: in function `GetAddOnMetadata'
[string "@ChocolateBar/modules/CB_PlayedTime_Options.lua"]:5: in main chunk

Locals:
(*temporary) = "CB_PlayedTime"
(*temporary) = "X-Curse-Packaged-Version"
(*temporary) = "Invalid AddOn name CB_PlayedTime. - Usage: local value = C_AddOns.GetAddOnMetadata(name, variable)"

67x ChocolateBar/modules/CB_PlayedTime.lua:106: attempt to call method 'RegisterOptions' (a nil value)
[string "@ChocolateBar/modules/CB_PlayedTime.lua"]:106: in function <ChocolateBar/modules/CB_PlayedTime.lua:98>

Locals:
(*temporary) = nil
(*temporary) = <table> {
}
(*temporary) = <table> {
  -- removed character names
}
(*temporary) = "attempt to call method 'RegisterOptions' (a nil value)"
db = <table> {
  -- removed character names
}
RequestTimePlayed = <function> defined @ChocolateBar/modules/CB_PlayedTime.lua:11
acetimer = <table> {
 embeds = <table> {
 }
 ScheduleRepeatingTimer = <function> defined @ArkInventory/Externals/Ace3/AceTimer/AceTimer-3.0.lua:129
 CancelAllTimers = <function> defined @ArkInventory/Externals/Ace3/AceTimer/AceTimer-3.0.lua:160
 OnEmbedDisable = <function> defined @ArkInventory/Externals/Ace3/AceTimer/AceTimer-3.0.lua:272
 CancelTimer = <function> defined @ArkInventory/Externals/Ace3/AceTimer/AceTimer-3.0.lua:147
 Embed = <function> defined @ArkInventory/Externals/Ace3/AceTimer/AceTimer-3.0.lua:260
 TimeLeft = <function> defined @ArkInventory/Externals/Ace3/AceTimer/AceTimer-3.0.lua:172
 ScheduleTimer = <function> defined @ArkInventory/Externals/Ace3/AceTimer/AceTimer-3.0.lua:94
 activeTimers = <table> {
 }
}
updateText = <function> defined @ChocolateBar/modules/CB_PlayedTime.lua:88
dataobj = <table> {
}
frame2 = Frame {
 0 = <userdata>
}

18x ChocolateBar/modules/CB_PlayedTime_Options.lua:1 (null)

12x Interface_Wrath\FrameXML\Bindings.xml:1 ChocolateBar/modules/CB_PlayedTime_Options.lua:1 (null)

2x ChocolateBar/modules/CB_PlayedTime.lua:26: attempt to call method 'OpenOptions' (a nil value)
[string "@ChocolateBar/modules/CB_PlayedTime.lua"]:26: in function `OnClick'
[string "@ChocolateBar/Chocolate.lua"]:298: in function <ChocolateBar/Chocolate.lua:295>

Locals:
self = ChocolateCB_PlayedTime {
 0 = <userdata>
 highlight = <function> defined @ChocolateBar/Chocolate.lua:359
 OnBackdropLoaded = <function> defined @SharedXML/Backdrop.lua:152
 GetBackdropColor = <function> defined @SharedXML/Backdrop.lua:390
 SetupTextureCoordinates = <function> defined @SharedXML/Backdrop.lua:214
 OnBackdropSizeChanged = <function> defined @SharedXML/Backdrop.lua:182
 HasBackdropInfo = <function> defined @SharedXML/Backdrop.lua:278
 SetBackdropBorderColor = <function> defined @SharedXML/Backdrop.lua:422
 SetBorderBlendMode = <function> defined @SharedXML/Backdrop.lua:266
 GetEdgeSize = <function> defined @SharedXML/Backdrop.lua:188
 labelText = ""
 obj = <table> {
 }
 name = "CB_PlayedTime"
 ApplyBackdrop = <function> defined @SharedXML/Backdrop.lua:294
 SetBackdrop = <function> defined @SharedXML/Backdrop.lua:329
 ClearBackdrop = <function> defined @SharedXML/Backdrop.lua:282
 settings = <table> {
 }
 GetBackdropBorderColor = <function> defined @SharedXML/Backdrop.lua:409
 GetBackdrop = <function> defined @SharedXML/Backdrop.lua:347
 text = FontString {
 }
 SetupPieceVisuals = <function> defined @SharedXML/Backdrop.lua:246
 SetBackdropColor = <function> defined @SharedXML/Backdrop.lua:399
 Update = <function> defined @ChocolateBar/Chocolate.lua:309
 bar = ChocolateBar1 {
 }
}
button = "RightButton"
(*temporary) = nil
(*temporary) = <table> {
}
(*temporary) = "attempt to call method 'OpenOptions' (a nil value)"
dataobj = <table> {
}
Kiatra commented 9 months ago

Should be fixed.