Fix crash due to recycled bitmap when edited bitmap returned is the same as source...

This commit is contained in:
Sylvain Berfini 2017-07-10 11:22:04 +02:00
parent 7832bc03d9
commit 459482b52b

View file

@ -913,8 +913,12 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
}
if (bm_tmp != null) {
if (bm_tmp != bm) {
bm.recycle();
bm = bm_tmp;
} else {
bm_tmp = null;
}
}
ByteArrayOutputStream stream = new ByteArrayOutputStream();
@ -1545,8 +1549,12 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
matrix.postRotate(270);
}
bm_tmp = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(), bm.getHeight(), matrix, true);
if (bm_tmp != bm) {
bm.recycle();
bm = bm_tmp;
} else {
bm_tmp = null;
}
} catch (Exception e) {
Log.e(e);
}