Diokuz / baron

Native scroll with custom scrollbar
MIT License
776 stars 124 forks source link

Memory leak: dispose() does not delete instance #186

Open Corvus278 opened 1 year ago

Corvus278 commented 1 year ago

In the params field of each instance there is an index field, which stores the index of the instance in the array of instances, by which it will be deleted from there after instanse.dispose(). Index is obtained from the data-attribute node of the scroller element. However, in data-attribute, the index is put in the init function, and it is obtained in the baron function BEFORE init. If an instance is created for a new scroller, the scroller does not have a data-attribute with an index, and 0 is written to instance.params.index.

Corvus278 commented 1 year ago

Fix it in PR - https://github.com/Diokuz/baron/pull/187