Plugin state reset after DAW restarts

Hi,

I’m meating an issue that my plugin states are all reset after Cubase project restarts. The settings are all working fine if I don’t close the project. I can close/reopen the GUI without any problem, but they are all reset after I close the project and reopen it.

I know this may be a silly question, but I don’t find the same issue in forum. Can someone give me some inputs? Thanks!

btw, I also noticed copy the plugin settings with Cubase doesn’t work with my plugin. I guess this may be related with the issue above?

Have you implemented the getStateInformation and setStateInformation methods in your plugin processor?

Yes, I implemented these functions. I also tried to remove the xml save in these functions and the states lost directly when I reopen the GUI window. But with the implementation, there is no problem when I reopen the GUI, the states only lost when I close the Cubase project. So I guess the issue should not be there? Or maybe I forgot something else?

This sounds very suspicious. AudioProcessor::getStateInformation and setStateInformation shouldn’t affect the editor at all. Are you doing something like directly accessing the editor from setStateInformation to update the view? If so, this is a bad idea.

I found the root cause after some debug. I used a unique_ptr for some string storage and append it to the state tree before the xml saving. And the issue seems to be life cycle related, the custom settings always lost when getStateInformation is called. After fixing the lifcycle issue, all works well.

Thanks for your help!