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

Linux: Check parent window is still valid before unmapping/destroying embedded OpenGL window

This commit is contained in:
ed 2020-07-06 11:18:55 +01:00
parent e9321bf565
commit a95ec7bc8f

View file

@ -126,13 +126,17 @@ public:
~NativeContext()
{
juce_LinuxRemoveRepaintListener (component.getPeer(), &dummy);
if (embeddedWindow != 0)
if (auto* peer = component.getPeer())
{
XWindowSystemUtilities::ScopedXLock xLock;
X11Symbols::getInstance()->xUnmapWindow (display, embeddedWindow);
X11Symbols::getInstance()->xDestroyWindow (display, embeddedWindow);
juce_LinuxRemoveRepaintListener (peer, &dummy);
if (embeddedWindow != 0)
{
XWindowSystemUtilities::ScopedXLock xLock;
X11Symbols::getInstance()->xUnmapWindow (display, embeddedWindow);
X11Symbols::getInstance()->xDestroyWindow (display, embeddedWindow);
X11Symbols::getInstance()->xSync (display, True);
}
}
if (bestVisual != nullptr)
@ -233,7 +237,7 @@ private:
GLXContext renderContext = {};
Window embeddedWindow = {};
int swapFrames = 0;
int swapFrames = 1;
Rectangle<int> bounds;
XVisualInfo* bestVisual = nullptr;
void* contextToShareWith;