Skip to content

WORKAROUND: flush caches to resources in ReferenceItem and Link

smtk::attribute::ReferenceItem and smtk::resource::Surrogate are designed to use weak pointers to resources as caching mechanisms to prevent repeated lookups in smtk::resource::Manager and to facilitate their use in a manager-less design (e.g. for scripting). There is currently a bug in SMTK/ModelBuilder where there are too many shared pointers to a loaded resource; when a resource is removed from the system, it persists in memory due to these untracked shared pointers. This results in the caching weak pointers never being invalid, so cache entries do not become stale and refresh via the resource manager. Until we track down all of the stray shared pointers to resources, this MR forces the caches in ReferenceItem and Link to refresh whenever they are accessed.

Merge request reports