Thread Tools Display Modes
Prev Previous Post   Next Post Next
04/20/15, 12:59 PM   #1
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 578
Access a private function ShowMenu Bug

Code:
EsoUI/Ingame/Inventory/InventorySlot.lua:903: attempt to access a private function 'PickupInventoryItem' from insecure code
stack traceback:
EsoUI/Ingame/Inventory/InventorySlot.lua:903: in function 'InitiateDestroyItem'
EsoUI/Ingame/Inventory/InventorySlot.lua:1453: in function 'OnSelect'
EsoUI/Libraries/ZO_ContextMenus/ZO_ContextMenus.lua:412: in function 'ZO_Menu_ClickItem'
8371350907706105899:4: in function '(main chunk)'
Report here:
Error deleting items every few hours.
=(
Looking for addon causing a bug

Any addon showing a context-menu can causes it. But there is nothing wrong with the calling:
ClearMenu() AddMenuItem ... ShowMenu(), right?

How to reproduce:
Do in chat window:
1. /reloadui
2. /script ClearMenu() AddMenuItem("") ShowMenu() ClearMenu()
3. Go and use an item of your inventory using context-menu

unsecure code?!?

Try this:
1. /reloadui
2. go and open journal and right-click a quest to open a context-menu. In fact any build-in context-menu would be ok. You could also open the context-menu of the inventory.
3. /script ClearMenu() AddMenuItem("") ShowMenu() ClearMenu()
4. Go and use an item of your inventory using context-menu

now the same code is secure.

The critical call is AddMenuItem("")
Here is another example:
"secure" code adding a normal button below the context-menu
Lua Code:
  1. local good = WINDOW_MANAGER:CreateControlFromVirtual("GoodBoy", ZO_Menu, "ZO_DefaultButton")
  2. good:SetDimensions(320, 32)
  3. good:SetAnchor(TOPLEFT, nil, BOTTOMLEFT)
  4. good:SetText("Click me")

"unsecure" code adding a ZO_MenuItem control.
Lua Code:
  1. local bad = WINDOW_MANAGER:CreateControlFromVirtual("BadBoy", ZO_Menu, "ZO_MenuItem")
  2. bad:GetNamedChild("Name"):SetText("Click me")
  3. bad:SetAnchor(TOPLEFT, nil, BOTTOMLEFT)
  4. bad:SetHidden(false)
It depends on who uses the template ZO_MenuItem first?!?

Seems to be a game-in bug. Or AddMenuItem should not be public. What else should be used?
  Reply With Quote
 

ESOUI » Developer Discussions » General Authoring Discussion » Access a private function ShowMenu Bug


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