View Single Post
04/16/17, 08:08 AM   #35
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
Hi Chip,

Thanks to Rhyono and Sounomi I found (or at least I believe to have found) what causes the problem when AwesomeGuildStore is active. They reported that the error shows up when trying to use an item in the inventory when the guild store is the first thing that is opened after loading the UI, but not when the inventory is opened first.

After some investigation I found that when a state change for the INVENTORY_FRAGMENT occurs, the state change callback calls ZO_InventoryManager:UpdateList which then lazily creates the scroll list rows for the passed inventory type. Because of this, all rows are then tainted and cause the issue at hand.
I don't think I can fix this on the addon side, so I hope you could add some code to fill the inventory row pool in InitializeInventoryList (inventory.lua:176)

e.g. add a new argument prefillCount to ZO_ScrollList_AddDataType
Lua Code:
  1. function ZO_ScrollList_AddDataType(self, typeId, templateName, height, setupCallback, hideCallback, dataTypeSelectSound, resetControlCallback, prefillCount)    
  2.     if(not self.dataTypes[typeId]) then
  3. ...
  4.         UpdateModeFromHeight(self, height)
  5.        
  6.         if(prefillCount) then
  7.             for i = 1, prefillCount do
  8.                 pool:AquireObject()
  9.             end
  10.             pool:ReleaseAllObjects()
  11.         end
  12.     end
  13. end

Lua Code:
  1. local ROW_HEIGHT = 52
  2. local function InitializeInventoryList(inventory)
  3.     local listView = inventory.listView
  4.     if listView then
  5.         ZO_ScrollList_Initialize(listView)
  6.         local prefillCount = math.ceil(listView:GetHeight() / ROW_HEIGHT)
  7.         ZO_ScrollList_AddDataType(listView, inventory.listDataType, inventory.rowTemplate, ROW_HEIGHT, inventory.listSetupCallback, inventory.listHiddenCallback, nil, ZO_InventorySlot_OnPoolReset, prefillCount)
  8.         ZO_ScrollList_AddResizeOnScreenResize(listView)
  9.     end
  10. end

Or just make it a boolean and handle the calculations inside, otherwise a screen resize could become an issue.
InventoryGridView will probably suffer from the same problem even when the pool is filled this way, but I haven't checked how the entries are handled there.
Maybe a way to specify a function for the prefillCount calculation before the pool is created would be helpful.

Last edited by sirinsidiator : 04/16/17 at 08:11 AM.
  Reply With Quote