Skip to content

Commit

Permalink
Guard against ObjectDisposedException in Post call
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsenko committed Jan 17, 2017
1 parent 7a7a94f commit f857bfe
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Source/ZXing.Net.Mobile.Android/ZXingTextureView.cs
Expand Up @@ -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}");

Expand Down

0 comments on commit f857bfe

Please sign in to comment.