The method being marked const guarantees that it doesn’t change anything in its AudioProcessor instance, but of course allocating memory and creating objects there is perfectly fine even in const methods.
Now, my 2 cents on the topic: the problem I see here is that the creation of a plug-in editor is likely to be the ideal spot where to load GFX assets. To avoid loading them over and over again for each plug-in instance, I’d keep them in a static singleton that’s initialised just once.
Now, if the Debug build creates an editor that the Release build does not create, the loading of those GFX assets happens at a whole different time in the two builds. Even if that doesn’t break/crash the plug-in, that still is a significant change in behavior that may cause issues when debugging user reports the likes of “my plug-in takes ages to open”, etc.
I’m also really struggling with this too. One of the things I learned very early on is that Hosts canand WILL do unexpected things around editor creation/destruction. Do not make any assumptions about how and when your editor constructor/destructor may or may not be called, in what order they may or may not be called, how long the life time of the editor may or may not be.
If this assert is causing issues whilst you’re developing then that’s a good thing, because it’s stopping you releasing code that will fail in the wild in certain hosts.
I see your point here, my point above was that this potentially induces a shift in where things happen between the debug and release builds, so that they have a slightly different behavior.
I agree with you that the plug-in should ideally be able to withstand such “stress” without crashing, both in release and debug builds.
What I’m saying is that, having a different behavior between the two, makes it slightly harder to debug issues when things become less “ideal” and there’s a problem to be debugged. This induced difference in behavior becomes a factor to be taken into account during that debugging, which would not be necessary if the sequence were guaranteed to be the same in both debug and release builds.
Completely agree, it’s far from ideal, and I’ve no idea how it could be mitigated without having this potential editor creation happen in Release builds for no reason what-so-ever.