Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

Commit

Permalink
Merge pull request #28 from rebuy-de/40682_fix_dispose
Browse files Browse the repository at this point in the history
refs #40682 add null check on dispose
  • Loading branch information
armintelker committed Apr 27, 2015
2 parents bc0f04e + 750189f commit a09f402
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Rb.Forms.Barcode.Droid/BarcodeScannerRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ protected override void Dispose(bool disposing)
this.Debug("Disposing");

BarcodeScannerRenderer.KeepCamera = false;
configurator.Dispose();
previewFrameCallback.Dispose();
configurator?.Dispose();
previewFrameCallback?.Dispose();
scannerService = null;
barcodeDecoder = null;

Expand Down
2 changes: 1 addition & 1 deletion Rb.Forms.Barcode.Droid/Camera/CameraConfigurator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ private bool isPickyDevice()
private void clearBuffers()
{
foreach (var buffer in buffers) {
buffer.Dispose();
buffer?.Dispose();
}

buffers = new List<FastJavaByteArray>();
Expand Down
4 changes: 2 additions & 2 deletions Rb.Forms.Barcode.Droid/View/PreviewFrameCallback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public PreviewFrameCallback(BarcodeDecoder decoder, BarcodeScanner scanner)
async public void OnPreviewFrame(IntPtr data, AndroidCamera camera)
{
if (buffer != null) {
buffer.Dispose();
buffer?.Dispose();
buffer = null;
}

Expand All @@ -49,7 +49,7 @@ async public void OnPreviewFrame(IntPtr data, AndroidCamera camera)

public void Dispose()
{
buffer.Dispose();
buffer?.Dispose();
base.Dispose();
}

Expand Down

0 comments on commit a09f402

Please sign in to comment.