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

Cleanup the Presentation class when disconnecting the Glasses #1763

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

javifernandez
Copy link
Member

@javifernandez javifernandez commented Feb 19, 2025

We are creating new instances of the VisionGlassPresentation class whenever the device is reconnected to the phone's USB port. This implies that the GLViewTexture we use to render the Wolvic window is recreated as well, hence it uses a different thread than the one used initially to setup the BrowserWorld::instance() singleton. This causes that subsequent calls to the different BrowserWorld native APIs (eg, activityCreated, activityPaused) fail due to the ASSERT_ON_RENDER_THREAD(); check.

The problem is not that the calls made by the VisionGlassPersentation class on the java side are not being performed in the GL thread, but that it's a different thread, as I commented before. It seems that the ASSERT_ON_RENDER_THREAD assertion just checks whether the current thread (pthread_self() ) is the same than the one stored in the BrowserWorld.instance() singleton (m,selfThread).

If we want to avoid restarting the whole app to handle the reconnection use case, we would need to cleanup the BrowserWorld data structures when we detect the disconnection event, so that the subsequent activityCreatedcalls are executed with the new GL thread.

Fixes #1764

@javifernandez javifernandez marked this pull request as draft February 19, 2025 09:20
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.

VisionGlass shows a black screen when reconnecitng the USB cable
1 participant