Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARCore crash when closing SharedCamera (itself) #1602

Open
DanPetras opened this issue Aug 17, 2023 · 1 comment
Open

ARCore crash when closing SharedCamera (itself) #1602

DanPetras opened this issue Aug 17, 2023 · 1 comment

Comments

@DanPetras
Copy link

SPECIFIC ISSUE ENCOUNTERED

Crash when CameraDevice.StateCallback.onError in called while using Session.Feature.SHARED_CAMERA

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.os.Handler.removeCallbacksAndMessages(java.lang.Object)' on a null object reference
com.google.ar.core.SharedCamera.close(SharedCamera.java:1)
com.google.ar.core.SharedCamera.-$$Nest$mclose(SharedCamera.java:0)
com.google.ar.core.ai.onError(SharedCamera.java:2)
android.hardware.camera2.impl.CameraDeviceImpl$8.run(CameraDeviceImpl.java:420)
android.os.Handler.handleCallback(Handler.java:942)
android.os.Handler.dispatchMessage(Handler.java:99)
android.os.Looper.loopOnce(Looper.java:211)
android.os.Looper.loop(Looper.java:300)
android.os.HandlerThread.run(HandlerThread.java:67)

Related "source code" in ARCore:

class SharedCamera {
    private void close() {
        // Next line is causing the crash if close is called multiple times for some reason
        this.sharedCameraHandler.removeCallbacksAndMessages((Object)null);
        this.sharedCameraHandler.getLooper().quit();
        this.sharedCameraHandler = null;
    }
}

VERSIONS USED

  • Android Studio: Android Studio Giraffe | 2022.3.1
  • ARCore SDK for Android: 1.38.0
  • Device manufacturer, model, and O/S: Various, Android 12 / 13
  • Google Play Services for AR (ARCore): Unknown (Crashlytics crash)

ADDITIONAL COMMENTS

When encountering CameraDevice.StateCallback.onError in our application we are already doing the cleanup:

com.google.ar.core.Session.pause()
android.hardware.camera2.CameraDevice.close()
com.google.ar.core.Session.close() // called on bg thread

It seems like ARCore itself is also trying to close the SharedCamera which was already closed by the app.

@DanPetras DanPetras added the bug label Aug 17, 2023
@devbridie devbridie self-assigned this Aug 17, 2023
@devbridie
Copy link
Member

Thanks for the report. A fix for this is going in in 1.40.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants