Edit Mode Expanded

Edit Mode Expanded

662k Downloads

I have some question about function EditModeExpandedSystemSettingsDialog:UpdateSettings

Etern213 opened this issue ยท 3 comments

commented

The function is here. It seems that this is copy and modified from blizzard code

I was confused about how pool works, seems that variable settingFrame in function UpdateSettings is create by settingFrame = settingPool:Acquire(). I was thinking about when should we call function UpdateSettings, only once on init? or every time we change something.
When we already call it on init, and call it again in script OnDragStop, will it create another settingframe or just use a old one?
If it create a new settingframe everytime we call UpdateSettings, I think we should call it more carefully, or there will be a lot of useless frame, and costs unnecessary resource.

After reading https://wowpedia.fandom.com/wiki/API_CreateObjectPool, I still don't know what 'pool' is. :(

commented

It seems that each time we call function UpdateSettings, it use self:ReleaseAllNonSliders() and self:ReleaseNonDraggingSliders() to release all settings we acquired before, and then reuse these frame by settingPool:Acquire().

So it just update a old frame when we call UpdateSettings, not create a new one.

Did I make a mistake somewhere?

commented

Sounds right. A 'pool' is a system for recycling frames instead of creating new ones.

commented

Sounds right. A 'pool' is a system for recycling frames instead of creating new ones.

Got it, thanks a lot.