ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Minor leak in CALLBACK_MANAGER (https://www.esoui.com/forums/showthread.php?t=6136)

votan 03/02/16 02:03 PM

Minor leak in CALLBACK_MANAGER
 
Hi Chip,

I have found something one of ZOS may look at some day:
Everytime you interact with a crafting station (except Alchemy) the number of registered callbacks of CraftingAnimationsStopped increases and does not decrease afterwards.

Tested without any addon, of course.

Code:

/script d(#CALLBACK_MANAGER.callbackRegistry["CraftingAnimationsStopped"])
Starting at 69. Go to crafting station, interact, close, 70, interact, close, 71, ...

The only station not affected is Alchemy.

This can't be good, but one has to interact a lot with crafting stations without reloading, so... :rolleyes:

Wandamey 03/02/16 03:00 PM

we could use a forum section for possible ESO/API bug reports too.

I had some troubles picking a subforum not long ago about the changes in a number of arguments that may have been overlooked in the gear crafting station, even if so far I've only found errors in addons due to this.

Mmmhhh I should have posted in the "site & forum" forum section, but it would have lacked of context :o

so while I'm at it, something else to report :
Idk if full style books items are really a thing or a legend but in any case : IsItemLinkBookKnown(itemLink) doesn't work with the full motif.


(sorry to derail your topic, votan :D)

votan 03/02/16 03:13 PM

Minor leak in CALLBACK_MANAGER (PTS)
 
At PTS the number of registered callbacks starts at 70, but the issue is still there.

Quote:

Originally Posted by Wandamey (Post 26308)
(sorry to derail your topic, votan :D)

No problem, Wandamey ;)

merlight 03/02/16 03:24 PM

Quote:

Originally Posted by Wandamey (Post 26308)
we could use a forum section for possible ESO/API bug reports too.

I used the Wish List section for those.

Wandamey 03/03/16 07:16 AM

Is the OP being investigated on PTS right now? Because I swear I just saw "OnSelectedPatternChanged" not triggering anymore since 10-15 min ago. I thought I mistype something, and replaced my file with the one working and uploaded here and still no debug output for

ZO_PreHook(ZO_Smithing,"OnSelectedPatternChanged", MyCustomFunction)

reloadui, unlog relog does nothing, I've compared the 2 files I had when it got boggus and found nothing "game breaking" (hahaha)

I suppose I'll check that later with more coffee in my belly but... weird.
If someone can throw a fresh pair of eyes on this please, I could avoid a coffein OD. Thanks.


hmmm... now its back... but I've deactivated all other addons. checking that again to find the culprit.
edit 2 : loaded the same set of addons that's definitively an addon conflict. sry.
edit 3 : relieved... it's not of of mine :D

Edit 4: yet it's a set of addons that I saved 2 or 3 days ago and it was working fine till today. Could be related to the issue above afaik.

OK that would be the old slider version of MultiCraft that broke it mysteriously around one hour ago :confused
re re edit... ah nuuh i know, i was on another char that usual, and my keybind for reloadui didn't work so i loaded my usual addon set to this char right before I re-checked the station for the second time today. But still, i'm pretty sure it was working yesterday on my usual char.
all of this to move a control of 2 UI units. /facepalm.

checking with the new version to see if all is good when up to date.

Edit : nope, still broken with MultiCraft v3. :(

Note to Ayantir : I see in your file that you reset the spinner with OnSelectedPatternChanged and rewrite the function for this. Just to be sure, OnSelectedPatternChanged triggers everytime any of the composant are selected to update the tooltip icon/info etc... not just the "pattern" pattern.
Looks kind of a bit overkill to me, or it is wanted? Anyway it breaks the prehook now, idk why, how, if it's a bug or if it'll stay like that. Afaik my addon QuickLeather is probably the only one using that prehook for now so if you have any advice...

Adding QuickLeather as OptionalDependsOn in MultiCraft manifest seems to work. But it doesn't look like a perfect solution at all. I'd rather have something to do on my end.

I should be able to transform my prehook into a posthook like you did, but that wouldn't solve that broken callback issue for other addons which would need it.

merlight 03/03/16 09:29 AM

Quote:

Originally Posted by Wandamey (Post 26324)
ZO_PreHook(ZO_Smithing,"OnSelectedPatternChanged", MyCustomFunction)

You're hooking the function in the class table. If another add-on hooks that function in the instance table BEFORE you do this, your hook will never run on the INSTANCE with earlier hook. It's generally better, and definitely less error-prone, to hook functions in instance tables. That way there's no quarrel who runs first, and everyone can call the original ZOS function if needs be.

Wandamey 03/03/16 09:39 AM

Quote:

Originally Posted by merlight (Post 26330)
You're hooking the function in the class table. If another add-on hooks that function in the instance table BEFORE you do this, your hook will never run on the INSTANCE with earlier hook. It's generally better, and definitely less error-prone, to hook functions in instance tables. That way there's no quarrel who runs first, and everyone can call the original ZOS function if needs be.

I have no idea what you just said, I can only guess that I'll have to try to replace ZO_Smithing with the table Ayantir uses?
Oww, just saw... I mistook PreHook for PreHookHandler and looked for a control (translated by "anything with ZO_" in my little head) instead of a table :eek: no idea how it worked till today then. Thanks for the explaining. I'll give it a try.

Mmmh and I got another one to replace : ZO_SmithingCreation for "OnFilterChanged" function, if someone knows what table it is before I find it, don't hesitate to spoil it to me :D


OK seems to work perfectly with SMITHING and SMITHING.creationPanel , no idea how i did not try that at all the first time. But that's nice, i've learnt something today.

ZOS_ChipHilseberg 03/03/16 10:29 AM

Quote:

Originally Posted by votan (Post 26307)
Hi Chip,

I have found something one of ZOS may look at some day:
Everytime you interact with a crafting station (except Alchemy) the number of registered callbacks of CraftingAnimationsStopped increases and does not decrease afterwards.

Tested without any addon, of course.

Code:

/script d(#CALLBACK_MANAGER.callbackRegistry["CraftingAnimationsStopped"])
Starting at 69. Go to crafting station, interact, close, 70, interact, close, 71, ...

The only station not affected is Alchemy.

This can't be good, but one has to interact a lot with crafting stations without reloading, so... :rolleyes:

We tracked down the bug and fixed it.

merlight 03/03/16 11:12 AM

Quote:

Originally Posted by Wandamey (Post 26331)
I have no idea what you just said, I can only guess that I'll have to try to replace ZO_Smithing with the table Ayantir uses?

SMITHING, that's the instance ...
... of class ZO_Smithing, a subclass ...
... of class ZO_Smithing_Common, a subclass ...
... of ZO_Object

When SMITHING:OnSelectedPatternChanged() is called, Lua looks for "OnSelectedPatternChanged" key
first in the "self" table you called it on -> SMITHING
if it's not there, it looks in the class -> ZO_Smithing
if it's not there, it looks in the base -> ZO_Smithing_Common
and so on

You can put your hooks anywhere in the hierarchy -- sometimes that's necessary, for example when there are many objects of a class, that are created on the fly, and you want to change the behaviour of all of them, past and future -- you replace methods in the class. But hooks higher in the hierarchy overrule base class hooks (more precisely that's because of how ZO_PreHook works; you could write a hook that honors base class overrides, but nobody does that). For singleton objects that are hooked by various add-ons it's best to hook on the singleton, highest level, so that your hooks aren't overruled.

Wandamey 03/03/16 11:33 AM

Quote:

Originally Posted by merlight (Post 26338)
SMITHING, that's the instance ...
... of class ZO_Smithing, a subclass ...
... of class ZO_Smithing_Common, a subclass ...
... of ZO_Object

When SMITHING:OnSelectedPatternChanged() is called, Lua looks for "OnSelectedPatternChanged" key
first in the "self" table you called it on -> SMITHING
if it's not there, it looks in the class -> ZO_Smithing
if it's not there, it looks in the base -> ZO_Smithing_Common
and so on

You can put your hooks anywhere in the hierarchy -- sometimes that's necessary, for example when there are many objects of a class, that are created on the fly, and you want to change the behaviour of all of them, past and future -- you replace methods in the class. But hooks higher in the hierarchy overrule base class hooks (more precisely that's because of how ZO_PreHook works; you could write a hook that honors base class overrides, but nobody does that). For singleton objects that are hooked by various add-ons it's best to hook on the singleton, highest level, so that your hooks aren't overruled.

When I think I was happy to just not have a nil error for the function I wanted to pick :D

I think I get it, if what you call "higher" in the hierarchy is the first checked? otherwise i may need to sleep on it. Like a whole year.
For now i'll just stick to this : "try a table first".


All times are GMT -6. The time now is 07:29 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI