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()
|
||||
{
|
||||
// Process all pending events
|
||||
if (!exists || window == null)
|
||||
return;
|
||||
|
||||
while (Functions.XCheckWindowEvent(window.Display, window.WindowHandle, window.EventMask, ref e) ||
|
||||
while (Exists && window != null &&
|
||||
Functions.XCheckWindowEvent(window.Display, window.WindowHandle, window.EventMask, ref e) ||
|
||||
Functions.XCheckTypedWindowEvent(window.Display, window.WindowHandle, XEventName.ClientMessage, ref e))
|
||||
{
|
||||
// Respond to the event e
|
||||
|
@ -585,8 +583,7 @@ namespace OpenTK.Platform.X11
|
|||
break;
|
||||
|
||||
case XEventName.ClientMessage:
|
||||
Debug.WriteLine("Client message received.");
|
||||
if (e.ClientMessageEvent.ptr1 == _atom_wm_destroy)
|
||||
if (!isExiting && e.ClientMessageEvent.ptr1 == _atom_wm_destroy)
|
||||
{
|
||||
Debug.WriteLine("Exit message received.");
|
||||
CancelEventArgs ce = new CancelEventArgs();
|
||||
|
@ -615,7 +612,7 @@ namespace OpenTK.Platform.X11
|
|||
if (Closed != null)
|
||||
Closed(this, EventArgs.Empty);
|
||||
|
||||
break;
|
||||
return;
|
||||
|
||||
case XEventName.ConfigureNotify:
|
||||
border_width = e.ConfigureEvent.border_width;
|
||||
|
@ -1353,6 +1350,8 @@ namespace OpenTK.Platform.X11
|
|||
if (manuallyCalled)
|
||||
{
|
||||
if (window != null && window.WindowHandle != IntPtr.Zero)
|
||||
{
|
||||
if (Exists)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -1366,6 +1365,7 @@ namespace OpenTK.Platform.X11
|
|||
|
||||
while (Exists)
|
||||
ProcessEvents();
|
||||
}
|
||||
|
||||
if (GraphicsContext.CurrentContext != null)
|
||||
GraphicsContext.CurrentContext.MakeCurrent(null);
|
||||
|
|
Loading…
Reference in a new issue