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

Linux: Remove embedded OpenGL window events from event queue when destroying

This fixes BadWindow errors from Expose events that may be processed after the window is destroyed.
This commit is contained in:
ed 2021-03-12 10:28:14 +00:00
parent 3dc97ec71c
commit 22777e5480

View file

@ -97,7 +97,7 @@ public:
XSetWindowAttributes swa;
swa.colormap = colourMap;
swa.border_pixel = 0;
swa.event_mask = ExposureMask | StructureNotifyMask;
swa.event_mask = embeddedWindowEventMask;
auto glBounds = component.getTopLevelComponent()
->getLocalArea (&component, component.getLocalBounds());
@ -133,9 +133,18 @@ public:
if (embeddedWindow != 0)
{
XWindowSystemUtilities::ScopedXLock xLock;
X11Symbols::getInstance()->xUnmapWindow (display, embeddedWindow);
X11Symbols::getInstance()->xDestroyWindow (display, embeddedWindow);
X11Symbols::getInstance()->xSync (display, False);
XEvent event;
while (X11Symbols::getInstance()->xCheckWindowEvent (display,
embeddedWindow,
embeddedWindowEventMask,
&event) == True)
{
}
}
}
@ -233,6 +242,8 @@ public:
struct Locker { Locker (NativeContext&) {} };
private:
static constexpr int embeddedWindowEventMask = ExposureMask | StructureNotifyMask;
Component& component;
GLXContext renderContext = {};
Window embeddedWindow = {};