From f857bfe3b455c9ca99f18c01d2321c3759753da5 Mon Sep 17 00:00:00 2001
From: "kasper@byolimit.com" <kasper@byolimit.com>
Date: Tue, 17 Jan 2017 14:21:54 +0100
Subject: [PATCH] Guard against ObjectDisposedException in Post call

---
 Source/ZXing.Net.Mobile.Android/ZXingTextureView.cs | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/Source/ZXing.Net.Mobile.Android/ZXingTextureView.cs b/Source/ZXing.Net.Mobile.Android/ZXingTextureView.cs
index e55357608..a119aa6b4 100644
--- a/Source/ZXing.Net.Mobile.Android/ZXingTextureView.cs
+++ b/Source/ZXing.Net.Mobile.Android/ZXingTextureView.cs
@@ -296,7 +296,13 @@ void SetSurfaceTransform(SurfaceTexture st, int width, int height)
 				var transform = new Matrix();
 				transform.SetScale(1f, aspectRatio * width / height); // lock on to width
 
-				Post(() => SetTransform(transform)); // ensure we use the right thread when updating transform
+				Post(() => {
+					try
+					{
+						SetTransform(transform);
+					}
+					catch (ObjectDisposedException) { } // todo: What to do here?! For now we squash :-/
+				}); // ensure we use the right thread when updating transform
 
 				Log.Debug(MobileBarcodeScanner.TAG, $"Aspect ratio: {aspectRatio}, Transform: {transform}");