diff --git a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp index 27f8ace149..b7ad307f7a 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp @@ -1102,11 +1102,19 @@ public: detach(); } + static void clearCachedImagesInComponentTree (Component& root) + { + root.setCachedComponentImage (nullptr); + + for (auto* child : root.getChildren()) + clearCachedImagesInComponentTree (*child); + } + void detach() { auto& comp = *getComponent(); stop(); - comp.setCachedComponentImage (nullptr); + clearCachedImagesInComponentTree (comp); context.nativeContext = nullptr; }