mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
Fix crash after OpenGL::detach in the presence of buffered child components
The crash fixed by this commit could be triggered by attaching an OpenGL
context to a component, calling setBufferedToImage (true) on one of its
child components, and then detaching the OpenGL context from the parent.
Since 4ba01a80a0 we are creating images
with the current rendering context's native image type, so the above
scenario would leave an image buffer that references the detached
context.
This commit is contained in:
parent
2da6a5fb62
commit
cb34975457
1 changed files with 9 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue