Maybe use the freestanding renderBitmapOffscreen function from coffscreencontext.h: vstgui/coffscreencontext.h at develop · steinbergmedia/vstgui · GitHub
It does what you want without a leak.
Maybe use the freestanding renderBitmapOffscreen function from coffscreencontext.h: vstgui/coffscreencontext.h at develop · steinbergmedia/vstgui · GitHub
It does what you want without a leak.