Skip to content

Conversation

Antiglobalist
Copy link
Contributor

@Antiglobalist Antiglobalist commented Mar 7, 2024

Discussion - #435
Issues:

  • lifecycle?.coroutineScope can be isActive == false and destroy() will not be called
  • destroyARCore was calling twice. It produced NDK crash from ARCore

The second call of destroy() was removed to prevent crash
Coroutines were replaced to ExecutorService


override fun destroy() {
if (!isDestroyed) {
destroyARCore()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You use LifeCycleObserver as the main place to call ArCore lifecycle functions
And you don't need to call it here again
I didn't find any side cases

}

fun destroyARCore() {
val scope = lifecycle?.coroutineScope ?: CoroutineScope(Dispatchers.IO)
Copy link
Contributor Author

@Antiglobalist Antiglobalist Mar 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I wrote in issue - Coroutines is not fit tool to execute background operation a specialty on Destroy callback

super.destroy()
}

fun destroyARCore() {
Copy link
Contributor Author

@Antiglobalist Antiglobalist Mar 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is no reasons to place public function cuz it's internal behavior
Same as all others lifecycle calls

Copy link
Contributor Author

@Antiglobalist Antiglobalist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notes

@sameerjj
Copy link
Contributor

looks good to me

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

Successfully merging this pull request may close these issues.

3 participants