GurliGebis / WoWAddon-AngrierWorldQuests

29 stars 14 forks source link

Attempt to compare number with table when Angrier World Quests is enabled #34

Closed Xaymar closed 1 year ago

Xaymar commented 1 year ago

The following error occurs attempting to change the world icon filter when Angrier World Quests is enabled:

Message: Interface/FrameXML/QuestMapFrame.lua:535: attempt to compare number with table
Time: Sat Jan 14 22:21:41 2023
Count: 1
Stack: Interface/FrameXML/QuestMapFrame.lua:535: attempt to compare number with table
[string "@Interface/FrameXML/QuestMapFrame.lua"]:535: in function <Interface/FrameXML/QuestMapFrame.lua:528>
[string "=[C]"]: in function `OnSelection'
[string "@Interface/AddOns/Blizzard_WorldMap/Blizzard_WorldMapTemplates.lua"]:125: in function `func'
[string "@Interface/SharedXML/UIDropDownMenu.lua"]:1007: in function `UIDropDownMenuButton_OnClick'
[string "*UIDropDownMenuTemplates.xml:136_OnClick"]:1: in function <[string "*UIDropDownMenuTemplates.xml:136_OnClick"]:1>

Locals: numPOIs = Button {
 0 = <userdata>
 IconOverlay = Texture {
 }
 Border = Texture {
 }
 OnMouseUp = <function> defined @Interface/AddOns/Blizzard_WorldMap/Blizzard_WorldMapTemplates.lua:69
 SetTrackingFilter = <function> defined @Interface/AddOns/Blizzard_WorldMap/Blizzard_WorldMapTemplates.lua:82
 OnMouseDown = <function> defined @Interface/AddOns/Blizzard_WorldMap/Blizzard_WorldMapTemplates.lua:56
 Background = Texture {
 }
 Icon = Texture {
 }
 KrowiWorldMapButtonsIndex = 0
 InitializeDropDown = <function> defined @Interface/AddOns/Blizzard_WorldMap/Blizzard_WorldMapTemplates.lua:123
 OnLoad = <function> defined @Interface/AddOns/Blizzard_WorldMap/Blizzard_WorldMapTemplates.lua:48
 HandlesGlobalMouseEvent = <function> defined @Interface/SharedXML/DropDownToggleButton.lua:7
 Refresh = <function> defined @Interface/AddOns/Blizzard_WorldMap/Blizzard_WorldMapTemplates.lua:74
 OnSelection = <function> defined =[C]:-1
 DropDown = Frame {
 }
 relativeFrame = ScrollFrame {
 }
 IsTrackingFilter = <function> defined @Interface/AddOns/Blizzard_WorldMap/Blizzard_WorldMapTemplates.lua:78
 OnLoad_Intrinsic = <function> defined @Interface/SharedXML/DropDownToggleButton.lua:3
}
poiTable = <table> {
}
(*temporary) = WorldMapFrame {
 0 = <userdata>
 ShouldPanOnClick = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:686
 GetGlobalPosition = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:541
 PanTo = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:653
 HandleUserActionOpenSelf = <function> defined @Interface/FrameXML/QuestLogOwnerMixin.lua:91
 AreDetailLayersLoaded = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:453
 RemovePin = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:218
 OnCanvasScaleChanged = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:593
 RemoveGlobalPinMouseActionHandler = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:840
 OnQuestLogOpen = <function> defined @Interface/FrameXML/QuestLogOwnerMixin.lua:219
 CalculatePinNudging = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:327
 OnCanvasSizeChanged = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:609
 ApplyPinPosition = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:513
 SetAreaTriggerIntersectsCallback = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:273
 ShouldZoomInstantly = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:694
 HandleUserActionToggleQuestLog = <function> defined @Interface/FrameXML/QuestLogOwnerMixin.lua:44
 NavBar = Frame {
 }
 pinNudgingDirty = false
 SetGlobalPinScale = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:898
 RefreshDebugAreaTriggers = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:401
 SetShouldNavigateOnClick = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:674
 NavigateToParentMap = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:786
 SetDebugAreaTriggersEn

No other addons are necessary to trigger this problem.

GurliGebis commented 1 year ago

From what I can see in that error, it doesn't mention AngierWorldQuests. I think it is a case of the normal Blizzard UI being buggy.

Xaymar commented 1 year ago

This does not happen without AngrierWorldQuests, as stated above.

GurliGebis commented 1 year ago

I can see at least KrowiWorldMapButtons running, since it is mentioned in the log above (KrowiWorldMapButtonsIndex) Does it happen with all addons disabled, except AngrierWorldQuests?

Xaymar commented 1 year ago

As stated in the OP, only Angrier World Quests is enabled. I do not even know what KrowiWorldMapButtons is, as it is not installed. I've attached a video showing the exact problem described in the OP - disabling only AngrierWorldQuests makes the map work as expected.

https://user-images.githubusercontent.com/437395/214324204-92920071-7023-4875-9a6e-64bdd164d1f4.mp4

GurliGebis commented 1 year ago

Thanks for the video. I have just tried it on my machine, and I'm unable to reproduce the issue by toggling dungeon instances on the map.

Can you try and reproduce it again, and when the error shows, just try running this in the chat window: /reload Then try again.

I have seen this error before, caused by unrelated things, and reloading the UI normally fixes it (which is what happens when you disable an addon). Just to rule out if it is the addon, or if it just is the reloading of the UI that causes it to go away.

The problem is, that Blizzards own UI causes all kinds of errors in 10.0.x

Thanks

Xaymar commented 1 year ago

Seems like the patch today fixed it. Why it ever happened will remain a mystery it seems.

Xaymar commented 1 year ago

Oh, nvm, it reset my Load out of date Addons setting again.

Xaymar commented 1 year ago
Message: Interface/FrameXML/QuestMapFrame.lua:535: attempt to compare number with table
Time: Wed Jan 25 10:49:18 2023
Count: 1
Stack: Interface/FrameXML/QuestMapFrame.lua:535: attempt to compare number with table
[string "@Interface/FrameXML/QuestMapFrame.lua"]:535: in function <Interface/FrameXML/QuestMapFrame.lua:528>
[string "=[C]"]: in function `OnSelection'
[string "@Interface/AddOns/Blizzard_WorldMap/Blizzard_WorldMapTemplates.lua"]:125: in function `func'
[string "@Interface/SharedXML/UIDropDownMenu.lua"]:1007: in function `UIDropDownMenuButton_OnClick'
[string "*UIDropDownMenuTemplates.xml:136_OnClick"]:1: in function <[string "*UIDropDownMenuTemplates.xml:136_OnClick"]:1>

Locals: numPOIs = Button {
 0 = <userdata>
 IconOverlay = Texture {
 }
 Border = Texture {
 }
 OnMouseUp = <function> defined @Interface/AddOns/Blizzard_WorldMap/Blizzard_WorldMapTemplates.lua:69
 SetTrackingFilter = <function> defined @Interface/AddOns/Blizzard_WorldMap/Blizzard_WorldMapTemplates.lua:82
 OnMouseDown = <function> defined @Interface/AddOns/Blizzard_WorldMap/Blizzard_WorldMapTemplates.lua:56
 Background = Texture {
 }
 Icon = Texture {
 }
 InitializeDropDown = <function> defined @Interface/AddOns/Blizzard_WorldMap/Blizzard_WorldMapTemplates.lua:123
 OnLoad = <function> defined @Interface/AddOns/Blizzard_WorldMap/Blizzard_WorldMapTemplates.lua:48
 HandlesGlobalMouseEvent = <function> defined @Interface/SharedXML/DropDownToggleButton.lua:7
 Refresh = <function> defined @Interface/AddOns/Blizzard_WorldMap/Blizzard_WorldMapTemplates.lua:74
 OnSelection = <function> defined =[C]:-1
 DropDown = Frame {
 }
 relativeFrame = ScrollFrame {
 }
 IsTrackingFilter = <function> defined @Interface/AddOns/Blizzard_WorldMap/Blizzard_WorldMapTemplates.lua:78
 OnLoad_Intrinsic = <function> defined @Interface/SharedXML/DropDownToggleButton.lua:3
}
poiTable = <table> {
}
(*temporary) = WorldMapFrame {
 0 = <userdata>
 ShouldPanOnClick = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:686
 GetGlobalPosition = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:541
 PanTo = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:653
 HandleUserActionOpenSelf = <function> defined @Interface/FrameXML/QuestLogOwnerMixin.lua:91
 AreDetailLayersLoaded = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:453
 RemovePin = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:218
 OnCanvasScaleChanged = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:593
 RemoveGlobalPinMouseActionHandler = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:840
 OnQuestLogOpen = <function> defined @Interface/FrameXML/QuestLogOwnerMixin.lua:219
 CalculatePinNudging = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:327
 OnCanvasSizeChanged = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:609
 ApplyPinPosition = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:513
 SetAreaTriggerIntersectsCallback = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:273
 ShouldZoomInstantly = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:694
 HandleUserActionToggleQuestLog = <function> defined @Interface/FrameXML/QuestLogOwnerMixin.lua:44
 NavBar = Frame {
 }
 pinNudgingDirty = false
 SetGlobalPinScale = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:898
 RefreshDebugAreaTriggers = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:401
 SetShouldNavigateOnClick = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:674
 NavigateToParentMap = <function> defined @Interface/AddOns/Blizzard_MapCanvas/Blizzard_MapCanvas.lua:786
 SetDebugAreaTriggersEnabled = <function> defined @Int

https://user-images.githubusercontent.com/437395/214533905-110643ab-8b36-4f96-a16b-7a39b2d0e568.mp4

GurliGebis commented 1 year ago

I just noticed - it looks like the text has been cut off in the error message above. Since I'm unable to reproduce the issue, I need the entire text from the error.

Most likely you need BugGrabber and BugSack addons to be able to see the entire error.

Xaymar commented 1 year ago

BugSack

2x FrameXML/QuestMapFrame.lua:535: attempt to compare number with table
[string "@FrameXML/QuestMapFrame.lua"]:535: in function <FrameXML/QuestMapFrame.lua:528>
[string "=[C]"]: in function `OnSelection'
[string "@Blizzard_WorldMap/Blizzard_WorldMapTemplates.lua"]:125: in function `func'
[string "@SharedXML/UIDropDownMenu.lua"]:1007: in function `UIDropDownMenuButton_OnClick'
[string "*UIDropDownMenuTemplates.xml:136_OnClick"]:1: in function <[string "*UIDropDownMenuTemplates.xml:136_OnClick"]:1>

Locals:
numPOIs = Button {
 0 = <userdata>
 IconOverlay = Texture {
 }
 Border = Texture {
 }
 OnMouseUp = <function> defined @Blizzard_WorldMap/Blizzard_WorldMapTemplates.lua:69
 SetTrackingFilter = <function> defined @Blizzard_WorldMap/Blizzard_WorldMapTemplates.lua:82
 OnMouseDown = <function> defined @Blizzard_WorldMap/Blizzard_WorldMapTemplates.lua:56
 Background = Texture {
 }
 Icon = Texture {
 }
 InitializeDropDown = <function> defined @Blizzard_WorldMap/Blizzard_WorldMapTemplates.lua:123
 OnLoad = <function> defined @Blizzard_WorldMap/Blizzard_WorldMapTemplates.lua:48
 HandlesGlobalMouseEvent = <function> defined @SharedXML/DropDownToggleButton.lua:7
 Refresh = <function> defined @Blizzard_WorldMap/Blizzard_WorldMapTemplates.lua:74
 OnSelection = <function> defined =[C]:-1
 DropDown = Frame {
 }
 relativeFrame = ScrollFrame {
 }
 IsTrackingFilter = <function> defined @Blizzard_WorldMap/Blizzard_WorldMapTemplates.lua:78
 OnLoad_Intrinsic = <function> defined @SharedXML/DropDownToggleButton.lua:3
}
poiTable = <table> {
}
(*temporary) = WorldMapFrame {
 0 = <userdata>
 ShouldPanOnClick = <function> defined @Blizzard_MapCanvas/Blizzard_MapCanvas.lua:686
 GetGlobalPosition = <function> defined @Blizzard_MapCanvas/Blizzard_MapCanvas.lua:541
 PanTo = <function> defined @Blizzard_MapCanvas/Blizzard_MapCanvas.lua:653
 HandleUserActionOpenSelf = <function> defined @FrameXML/QuestLogOwnerMixin.lua:91
 AreDetailLayersLoaded = <function> defined @Blizzard_MapCanvas/Blizzard_MapCanvas.lua:453
 RemovePin = <function> defined @Blizzard_MapCanvas/Blizzard_MapCanvas.lua:218
 OnCanvasScaleChanged = <function> defined @Blizzard_MapCanvas/Blizzard_MapCanvas.lua:593
 RemoveGlobalPinMouseActionHandler = <function> defined @Blizzard_MapCanvas/Blizzard_MapCanvas.lua:840
 OnQuestLogOpen = <function> defined @FrameXML/QuestLogOwnerMixin.lua:219
 CalculatePinNudging = <function> defined @Blizzard_MapCanvas/Blizzard_MapCanvas.lua:327
 OnCanvasSizeChanged = <function> defined @Blizzard_MapCanvas/Blizzard_MapCanvas.lua:609
 ApplyPinPosition = <function> defined @Blizzard_MapCanvas/Blizzard_MapCanvas.lua:513
 SetAreaTriggerIntersectsCallback = <function> defined @Blizzard_MapCanvas/Blizzard_MapCanvas.lua:273
 ShouldZoomInstantly = <function> defined @Blizzard_MapCanvas/Blizzard_MapCanvas.lua:694
 HandleUserActionToggleQuestLog = <function> defined @FrameXML/QuestLogOwnerMixin.lua:44
 NavBar = Frame {
 }
 pinNudgingDirty = false
 SetGlobalPinScale = <function> defined @Blizzard_MapCanvas/Blizzard_MapCanvas.lua:898
 RefreshDebugAreaTriggers = <function> defined @Blizzard_MapCanvas/Blizzard_MapCanvas.lua:401
 SetShouldNavigateOnClick = <function> defined @Blizzard_MapCanvas/Blizzard_MapCanvas.lua:674
 NavigateToParentMap = <function> defined @Blizzard_MapCanvas/Blizzard_MapCanvas.lua:786
 SetDebugAreaTriggersEnabled = <function> defined @Blizzard_MapCanvas/Blizzard_MapCanvas.lua:425
 SetFocusedQuestID = <function> defined @Blizzard_WorldMap/Blizzard_WorldMap.lua:420
 UnregisterEvents = <function> defined @SharedXML/CallbackRegistry.lua:165
 EvaluateLockReasons = <function> defined @Blizzard_MapCanvas/Blizzard_MapCanvas.lua:756
 GetGlobalPinScale = <function> defined @Blizzard_MapCanvas/Blizzard_MapCanvas.lua:894
 SetDisplayState = <function> defined @FrameXML/QuestLogOwnerMixin.lua:99
 TitleCanvasSpacerFrame = Frame {
 }
 OnLoad = <function> defined @Blizzard_WorldMap/Blizzard_WorldMap.lua:82
 RemoveDataProviderEvent = <function> defined @Blizzard_MapCanvas/Blizzard_MapCanvas.lua:128
 GetNumActivePins

BugGrabber also ends at that exact point.

Xaymar commented 1 year ago

I did a bit of digging myself after finding a source for the Blizzard UI code. This line causes the error, as it expects numPOIs to be a number. Instead it sees a table when AngrierWorldQuests is enabled, which is unexpected as it does toggle. Looking at how this function is called reveals several calls by Blizzards UI itself, which all work fine, and two in this addon.

Two locations are suspected to trigger the bug, this one being more likely than this one. Armed with this knowledge, I dug out the remains of my Lua knowledge from Garry's mod days, and changed the former to:

        if of.OnLoad and of.OnLoad == WorldMapTrackingOptionsButtonMixin.OnLoad then
            hooksecurefunc(of, "OnSelection", function()
                QuestMapFrame_UpdateAll()
            end)
        end

And tada, no more error. The reason for this is likely due to hooksecurefunc passing the original arguments of (of).OnSelection to the hook function, thus invoking QuestMapFrame_UpdateAll() with a table.

GurliGebis commented 1 year ago

Thanks - I'll take a look at it some time during the weekend (IRL is pretty busy). If you want, you can create a pull request for it, and I'll be happy to create a beta release with it right away.

GurliGebis commented 1 year ago

I have pushed v0.40.5 with your fix. Thanks