The problem is that Image is a class you are supposed to use as a value and not via pointers. (Unless there’s some good reason to go through pointers.)
I’m not sure what’s happening here, but maybe there is a leak with the copy constructor; Avoided in the second case because there is some move operator involved ?
Image is reference counted. It self-deletes. You shouldn’t allocate it on the heap because it does that automatically for its internal pixel data. Look at the implementation of the Image class
in your handleAsyncUpdate() you should just do _rendered = createComponentSnapshot(getLocalBounds());
where _rendered is Image _rendered;
Also, you shouldn’t use underscores in your variable names, as that character’s use as the start of a variable name is considered reserved for the standard library.
Ok ! It makes sense now. So I probably would run into the same kind of issue if I use the ValueTree class with new.
Good to know. My company use the underscore for private class members everywhere so it’s a bit late too change. But I’ll remember it for others projects.