From 57ceff19b90b3326ed5a830f2f8f5e80037cf3d7 Mon Sep 17 00:00:00 2001 From: Tzach Shabtay Date: Sun, 11 Dec 2016 17:47:26 -0500 Subject: [PATCH 1/3] Android- Fix crash when querying for surface when window info was not created yet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit HasSurface is called by ReadyToRender property to query if the surface was created, but it’s possible that the window info was not created yet, added a missing null check. --- src/OpenTK/Platform/Android/AndroidGraphicsContext.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenTK/Platform/Android/AndroidGraphicsContext.cs b/src/OpenTK/Platform/Android/AndroidGraphicsContext.cs index f4fd54dc..c4edb69d 100644 --- a/src/OpenTK/Platform/Android/AndroidGraphicsContext.cs +++ b/src/OpenTK/Platform/Android/AndroidGraphicsContext.cs @@ -57,7 +57,7 @@ namespace OpenTK.Platform.Android { public bool HasSurface { - get { return eglWindowInfo.Surface != IntPtr.Zero; } + get { return eglWindowInfo != null && eglWindowInfo.Surface != IntPtr.Zero; } } public ISurfaceHolder Holder { From 0e20faf8966ac7b3a0297a42e3c64b55d6240e27 Mon Sep 17 00:00:00 2001 From: Tzach Shabtay Date: Sun, 11 Dec 2016 17:50:38 -0500 Subject: [PATCH 2/3] Android- fix a crash when the game view is closed before it started running MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the game view is closed, if it hasn’t started running yet the stopwatch would still be null- added a null check. --- src/OpenTK/Platform/Android/AndroidGameView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenTK/Platform/Android/AndroidGameView.cs b/src/OpenTK/Platform/Android/AndroidGameView.cs index cb438b67..6d6d01e0 100644 --- a/src/OpenTK/Platform/Android/AndroidGameView.cs +++ b/src/OpenTK/Platform/Android/AndroidGameView.cs @@ -457,7 +457,7 @@ namespace OpenTK.Platform.Android // if the render thread is paused, let it run so it exits pauseSignal.Set (); - stopWatch.Stop (); + if (stopWatch != null) stopWatch.Stop (); } void PauseThread () From 51e2b3915cb63f41e7bcfd4f8bb1615304ac25fc Mon Sep 17 00:00:00 2001 From: Tzach Shabtay Date: Sun, 11 Dec 2016 18:11:56 -0500 Subject: [PATCH 3/3] Removed redundant printout for "OnMouseMove called without moving the mouse" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes #416. The problem with this printout (as explained in the issue) is that on Windows (at least for specific devices/OS) GetMouseMovePointsEx can return duplicate points, so it’s either adding a check in the Windows layer or remove the printout. Adding a check in the Windows layer looks redundant though, as this is already checked in NativeWindowBase, so removing the printout looks preferable. --- src/OpenTK/Platform/NativeWindowBase.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/OpenTK/Platform/NativeWindowBase.cs b/src/OpenTK/Platform/NativeWindowBase.cs index 8e1a7ef2..16579e53 100644 --- a/src/OpenTK/Platform/NativeWindowBase.cs +++ b/src/OpenTK/Platform/NativeWindowBase.cs @@ -269,7 +269,6 @@ namespace OpenTK.Platform if (e.XDelta == 0 && e.YDelta == 0) { - Debug.WriteLine("OnMouseMove called without moving the mouse"); return; }