Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions arsceneview/src/main/java/io/github/sceneview/ar/ARSceneView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -567,11 +567,19 @@ open class ARSceneView @JvmOverloads constructor(

lightEstimator?.destroy()
planeRenderer.destroy()
destroyArCore()
}

super.destroy()
}

private fun destroyArCore() {
Executors.newSingleThreadExecutor().execute {
// destroy should be called off the main thread since it hangs for many seconds
arCore.destroy()
}
}

class DefaultARCameraNode(engine: Engine) : ARCameraNode(engine) {
init {
// Set the exposure on the camera, this exposure follows the sunny f/16 rule
Expand All @@ -595,10 +603,7 @@ open class ARSceneView @JvmOverloads constructor(
}

override fun onDestroy(owner: LifecycleOwner) {
Executors.newSingleThreadExecutor().execute {
// destroy should be called off the main thread since it hangs for many seconds
arCore.destroy()
}
destroyArCore()
}
}

Expand Down
1 change: 1 addition & 0 deletions sceneview/src/main/java/io/github/sceneview/SceneView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ open class SceneView @JvmOverloads constructor(
open fun destroy() {
if (!isDestroyed) {
lifecycle = null
Choreographer.getInstance().removeFrameCallback(frameCallback)

runCatching { uiHelper.detach() }

Expand Down