1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-08 23:24:19 +00:00

OpenGL: Fix missing buffered image after context detach

Prior to this commit a Component with setBufferedToImage (true) could
have its image buffer deleted when an OpenGL context was detached. This
meant that this Component continued to be rendered without buffering
even though it was previously requested that it use a buffer.
This commit is contained in:
attila 2025-11-18 15:55:07 +01:00 committed by Attila Szarvas
parent ef54f013c3
commit a9779b4546
3 changed files with 8 additions and 9 deletions

View file

@ -32,6 +32,8 @@
==============================================================================
*/
#include "juce_ScalingHelpers.h"
namespace juce::detail
{

View file

@ -32,6 +32,8 @@
==============================================================================
*/
#pragma once
namespace juce::detail
{

View file

@ -32,6 +32,8 @@
==============================================================================
*/
#include <juce_gui_basics/detail/juce_ComponentHelpers.h>
#if JUCE_MAC
#include <juce_gui_basics/native/juce_PerScreenDisplayLinks_mac.h>
#endif
@ -1102,19 +1104,12 @@ public:
detach();
}
static void clearCachedImagesInComponentTree (Component& root)
{
root.setCachedComponentImage (nullptr);
for (auto* child : root.getChildren())
clearCachedImagesInComponentTree (*child);
}
void detach()
{
auto& comp = *getComponent();
stop();
clearCachedImagesInComponentTree (comp);
detail::ComponentHelpers::releaseAllCachedImageResources (comp);
comp.setCachedComponentImage (nullptr);
context.nativeContext = nullptr;
}