mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-24 18:05:34 +00:00
* X11GLNative.cs: Added more defensive checks for the existence of the window before issuing XDestroyWindow.
Do not allow multiple calls to XDestroyWindow once the shutdown sequence has been initialized. Fixes issue [#1190]: "GameWindow dispose on linux".
This commit is contained in:
parent
162faad8e3
commit
2b7ed38569
|
@ -551,10 +551,8 @@ namespace OpenTK.Platform.X11
|
||||||
public void ProcessEvents()
|
public void ProcessEvents()
|
||||||
{
|
{
|
||||||
// Process all pending events
|
// Process all pending events
|
||||||
if (!exists || window == null)
|
while (Exists && window != null &&
|
||||||
return;
|
Functions.XCheckWindowEvent(window.Display, window.WindowHandle, window.EventMask, ref e) ||
|
||||||
|
|
||||||
while (Functions.XCheckWindowEvent(window.Display, window.WindowHandle, window.EventMask, ref e) ||
|
|
||||||
Functions.XCheckTypedWindowEvent(window.Display, window.WindowHandle, XEventName.ClientMessage, ref e))
|
Functions.XCheckTypedWindowEvent(window.Display, window.WindowHandle, XEventName.ClientMessage, ref e))
|
||||||
{
|
{
|
||||||
// Respond to the event e
|
// Respond to the event e
|
||||||
|
@ -585,8 +583,7 @@ namespace OpenTK.Platform.X11
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XEventName.ClientMessage:
|
case XEventName.ClientMessage:
|
||||||
Debug.WriteLine("Client message received.");
|
if (!isExiting && e.ClientMessageEvent.ptr1 == _atom_wm_destroy)
|
||||||
if (e.ClientMessageEvent.ptr1 == _atom_wm_destroy)
|
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Exit message received.");
|
Debug.WriteLine("Exit message received.");
|
||||||
CancelEventArgs ce = new CancelEventArgs();
|
CancelEventArgs ce = new CancelEventArgs();
|
||||||
|
@ -614,8 +611,8 @@ namespace OpenTK.Platform.X11
|
||||||
|
|
||||||
if (Closed != null)
|
if (Closed != null)
|
||||||
Closed(this, EventArgs.Empty);
|
Closed(this, EventArgs.Empty);
|
||||||
|
|
||||||
break;
|
return;
|
||||||
|
|
||||||
case XEventName.ConfigureNotify:
|
case XEventName.ConfigureNotify:
|
||||||
border_width = e.ConfigureEvent.border_width;
|
border_width = e.ConfigureEvent.border_width;
|
||||||
|
@ -1354,19 +1351,22 @@ namespace OpenTK.Platform.X11
|
||||||
{
|
{
|
||||||
if (window != null && window.WindowHandle != IntPtr.Zero)
|
if (window != null && window.WindowHandle != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
try
|
if (Exists)
|
||||||
{
|
{
|
||||||
Functions.XLockDisplay(window.Display);
|
try
|
||||||
Functions.XDestroyWindow(window.Display, window.WindowHandle);
|
{
|
||||||
}
|
Functions.XLockDisplay(window.Display);
|
||||||
finally
|
Functions.XDestroyWindow(window.Display, window.WindowHandle);
|
||||||
{
|
}
|
||||||
Functions.XUnlockDisplay(window.Display);
|
finally
|
||||||
}
|
{
|
||||||
|
Functions.XUnlockDisplay(window.Display);
|
||||||
while (Exists)
|
}
|
||||||
ProcessEvents();
|
|
||||||
|
|
||||||
|
while (Exists)
|
||||||
|
ProcessEvents();
|
||||||
|
}
|
||||||
|
|
||||||
if (GraphicsContext.CurrentContext != null)
|
if (GraphicsContext.CurrentContext != null)
|
||||||
GraphicsContext.CurrentContext.MakeCurrent(null);
|
GraphicsContext.CurrentContext.MakeCurrent(null);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue