Add gesture disposed check to FrameRenderer (#829)
authorE.Z. Hart <hartez@users.noreply.github.com>
Wed, 22 Mar 2017 10:40:15 +0000 (04:40 -0600)
committerRui Marinho <me@ruimarinho.net>
Wed, 22 Mar 2017 10:40:15 +0000 (10:40 +0000)
Xamarin.Forms.Platform.Android/AppCompat/FrameRenderer.cs

index 6954654..7c40ea8 100644 (file)
@@ -83,6 +83,13 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
                                        ScaleGestureDetectorCompat.SetQuickScaleEnabled(_scaleDetector.Value, true);
                                handled = _scaleDetector.Value.OnTouchEvent(e);
                        }
+
+                       if (_gestureDetector.IsValueCreated && _gestureDetector.Value.Handle == IntPtr.Zero)
+                       {
+                               // This gesture detector has already been disposed, probably because it's on a cell which is going away
+                               return handled;
+                       }
+
                        return _gestureDetector.Value.OnTouchEvent(e) || handled;
                }