anibali / pyisyntax

A Python library for working with iSyntax file format images
MIT License
2 stars 2 forks source link

Destroy cache on close? #9

Closed erikogabrielsson closed 5 months ago

erikogabrielsson commented 5 months ago

Should the cache be destroyed on close()? Maybe

if self._cache is not None and not self._cache.destroyed:
    self._cache.destroy()
anibali commented 5 months ago

Fixed in https://github.com/anibali/pyisyntax/commit/8fe4c9475139b73b0e81041cc699fab0d54fcda6

Note that this issue isn't as big as it may initially seem, as cache objects are automatically destroyed when they are garbage collected. The code change simply removes the reference to the cache when an ISyntax object is closed. This leaves room for potential cache object reuse in the future.