sequence_data life cycle
Hello,
I am creating an object instance during PF_Cmd_SEQUENCE_SETUP and I want to use reference counting to keep it around during PF_Cmd_SEQUENCE_FLATTEN, PF_Cmd_SEQUENCE_RESETUP and
PF_Cmd_SEQUENCE_SETDOWN.
What I do:
- Setup: creates the object instance and associates an UUID to it and sequence_data stores object instance pointer + UUID.
- Flatten: creates a flat representation of sequence_data (used for serialization). In my case, I put the UUID of my object in the flat data.
- Resetup: get back a pointer to the object from UUID or create one if not found (when loading from a file)
- Setdown: release the object if ref count goes down to 0.
I am not sure how to do ref counting. For example, if I create a new project with a media, associate the plugin to a layer and then close the project, I got these numbers of call (in AE 2024 24.6.1 build 2):
- Setup: 1
- Flatten: 1
- Resetup: 4
- Setdown: 4
This works for sequence_data which is created in Setup, destroyed in Flatten (which creates a flat sequence_data which is kept around), sequence_data (unflat) is then recreated in Resetup. So Setdown is OK to destroy the 4 sequence_data creatd in Resetup.
In my case, I do not want to release my object instance in Flatten. So perhaps, I should release it when ref count goes down to one in Setdown or use PF_Cmd_GET_FLATTENED_SEQUENCE_DATA ?
