I have restarted an application after a few months and now it does not restore the state

I don’t know what changes could have damaged it, there have only been two important things, the Juce update, and the VS 2022 update.

Maybe you could advise me on how to find the problem. So far I have verified that the setStateInformation function is called, and the received parameters seem correct, the pointer to data is not null, and sizeInBytes seems correct. I check that it is valid and copyPropertiesAndChildrenFrom is called.

auto treeValue = juce::ValueTree::readFromData(data, size_t(sizeInBytes));
if (treeValue.isValid()) treeState.state.copyPropertiesAndChildrenFrom(treeValue, nullptr);

however, no parameter is updated, as it used to be.

Finally I have remake from scratch the application and it works again. I never know what the problem was.

Just a side note (might not be cause of your problem): you should use saveState and restoreState from APVTS for the proper thread safety :slight_smile:

I do it from set and getStateInformation.

In any case, I haven’t had any problems since I rebuilt the application from scratch with the latest version of Juce. It must be a problem with some update

The problem is this line. Use the built in function in the apvts to have proper thread safety.