From 8c10b7ba048544b4a95f8f19c704b679d58c7ebf Mon Sep 17 00:00:00 2001 From: JohnG Date: Sun, 1 May 2011 15:13:34 -0400 Subject: [PATCH] Polar parser --- .../services/sensors/BluetoothConnectionManager.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MyTracks/src/com/google/android/apps/mytracks/services/sensors/BluetoothConnectionManager.java b/MyTracks/src/com/google/android/apps/mytracks/services/sensors/BluetoothConnectionManager.java index 3f95db95f..3f1c6ba27 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/services/sensors/BluetoothConnectionManager.java +++ b/MyTracks/src/com/google/android/apps/mytracks/services/sensors/BluetoothConnectionManager.java @@ -394,8 +394,10 @@ public class BluetoothConnectionManager { offset = 0; - // Send the obtained bytes to the UI Activity - handler.obtainMessage(MESSAGE_READ, bytes, -1, buffer) + // Send copy of the obtained bytes to the UI Activity. + // Avoids memory inconsistency issues. + byte[] b = buffer.clone(); + handler.obtainMessage(MESSAGE_READ, bytes, -1, b) .sendToTarget(); } catch (IOException e) { Log.e(Constants.TAG, "disconnected", e);