ubports / unity8

The operating environment for everywhere. Lomiri development has moved to https://gitlab.com/ubports/development/core/lomiri
https://lomiri.com/
GNU General Public License v3.0
722 stars 99 forks source link

Fix ghost window if application creates and destroys surface early in lifecycle #417

Closed NotKit closed 2 years ago

NotKit commented 2 years ago

When surface is destroyed by application, SurfaceManager won't destroy it immediately if it is displayed. liveChanged(false) signal is propagaded instead all the way up to ApplicationWindow.qml and TopLevelWindowModel. TopLevelWindowModel may set removeOnceSurfaceDestroyed = true to remove the window in onSurfaceDestroyed handler. However it won't get fired until ApplicationWindow unreferences surface in surfaceContainer.

ApplicationWindow has a surfaceInitialized variable hack which is set by a timer after 100ms the surface is live. So if a surface is destroyed faster than that, it never sets the variable and does not reach "closed" state which unreferences the surface.

Attempt to fix that by introducing one more "surfaceSeenLive" variable that is set once surface becomes live and helps to understand if it appeared but died too quickly.

Flohack74 commented 2 years ago

Please, do not forget to add this to a project board so it does not slip QA and release notes, and also, please create an issue to link the MR to next time.

Flohack74 commented 2 years ago

Also please add test instructions for QA team.

cibersheep commented 2 years ago

(as asked above) How can we test this?

Flohack74 commented 2 years ago

@NotKit please give some QA instructions, we need to test this for OTA-20.

Flohack74 commented 2 years ago

From Nikita: Hi. This was basically a fix for Waydroid leaving empty window after the session had been started, clicking which would crash the compositor - so someone with Waydroid should test this.

c4pp4 commented 2 years ago

There was three windows on OTA-19 when starting Waydroid - window with android, window with Unity8 label and window with Waydroid logo. Now there are only two, the one with Unity8 label is "missing", so I think it's fixed.