exp/sensor: fix segfault while releasing thread looper

Only the loopers allocated with ALooper_acquire are releasable. We are
depending on the looper associated to the thread which will be
automatically released when the thread is being terminated.

Trying to re-release a looper makes the app crash with segfault.

Change-Id: Ib80549de01f5f44143752c13a82b6b4a2ab5610e
Reviewed-on: https://go-review.googlesource.com/15491
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
Burcu Dogan 2015-10-06 15:14:36 -07:00
parent 2fe453d27f
commit e8b7f9598a
1 changed files with 2 additions and 1 deletions

View File

@ -69,5 +69,6 @@ int GoAndroid_readQueue(int n, int32_t* types, int64_t* timestamps, float* vecto
void GoAndroid_destroyManager() { void GoAndroid_destroyManager() {
ASensorManager* manager = ASensorManager_getInstance(); ASensorManager* manager = ASensorManager_getInstance();
ASensorManager_destroyEventQueue(manager, queue); ASensorManager_destroyEventQueue(manager, queue);
ALooper_release(looper); queue = NULL;
looper = NULL;
} }