on xenial help sign in
Merge pull request #417 from ubports/xenial_-_ghostwindowfix
3981e79NotKit
plugins/WindowManager/TopLevelWindowModel.cpp+4−3
@@ -317,10 +317,11 @@ void TopLevelWindowModel::onSurfaceDied(unityapi::MirSurfaceInterface *surface)
317
317
318 auto application = m_windowModel[i].application;
318 auto application = m_windowModel[i].application;
319
319
320− // can't be starting if it already has a surface
320+ DEBUG_MSG << " application->name()=" << application->name()
321− Q_ASSERT(application->state() != unityapi::ApplicationInfoInterface::Starting);
321+ << " application->state()=" << application->state();
322
322
323− if (application->state() == unityapi::ApplicationInfoInterface::Running) {
323+ if (application->state() == unityapi::ApplicationInfoInterface::Running
324+ || application->state() == unityapi::ApplicationInfoInterface::Starting) {
324 m_windowModel[i].removeOnceSurfaceDestroyed = true;
325 m_windowModel[i].removeOnceSurfaceDestroyed = true;
325 } else {
326 } else {
326 // assume it got killed by the out-of-memory daemon.
327 // assume it got killed by the out-of-memory daemon.
qml/Stage/ApplicationWindow.qml+12−3
@@ -53,6 +53,7 @@ FocusScope {
53 if (surface) {
53 if (surface) {
54 surfaceContainer.surface = surface;
54 surfaceContainer.surface = surface;
55 d.liveSurface = surface.live;
55 d.liveSurface = surface.live;
56+ d.surfaceSeenLive = d.liveSurface;
56 d.hadSurface = false;
57 d.hadSurface = false;
57 surfaceInitTimer.start();
58 surfaceInitTimer.start();
58 } else {
59 } else {
@@ -70,7 +71,12 @@ FocusScope {
70 property bool liveSurface: false;
71 property bool liveSurface: false;
71 property var con: Connections {
72 property var con: Connections {
72 target: root.surface
73 target: root.surface
74+ onLiveChanged: {
73− onLiveChanged: d.liveSurface = root.surface.live
75+ d.liveSurface = root.surface.live;
76+ if (d.liveSurface) {
77+ d.surfaceSeenLive = true;
78+ }
79+ }
74 }
80 }
75 // using liveSurface instead of root.surface.live because with the latter
81 // using liveSurface instead of root.surface.live because with the latter
76 // this expression is not reevaluated when root.surface changes
82 // this expression is not reevaluated when root.surface changes
@@ -101,6 +107,7 @@ FocusScope {
101 // might show the UI accommodating due to surface resizes on startup.
107 // might show the UI accommodating due to surface resizes on startup.
102 // Remove this when possible
108 // Remove this when possible
103 property bool surfaceInitialized: false
109 property bool surfaceInitialized: false
110+ property bool surfaceSeenLive: false
104
111
105 readonly property bool supportsSurfaceResize:
112 readonly property bool supportsSurfaceResize:
106 application &&
113 application &&
@@ -251,6 +258,7 @@ FocusScope {
251 name: "splashScreen"
258 name: "splashScreen"
252 when:
259 when:
253 !d.hadSurface && (!root.surface || !d.surfaceInitialized)
260 !d.hadSurface && (!root.surface || !d.surfaceInitialized)
261+ && (d.liveSurface || !d.surfaceSeenLive)
254 &&
262 &&
255 screenshotImage.status !== Image.Ready
263 screenshotImage.status !== Image.Ready
256 },
264 },
@@ -283,8 +291,9 @@ FocusScope {
283 when:
291 when:
284 // The surface died while the application is running. It must have been closed
292 // The surface died while the application is running. It must have been closed
285 // by the shell or the application decided to destroy it by itself
293 // by the shell or the application decided to destroy it by itself
286− root.surface && d.surfaceInitialized && !d.liveSurface
294+ root.surface && (d.surfaceInitialized || d.surfaceSeenLive) && !d.liveSurface
287− && d.applicationState === ApplicationInfoInterface.Running
295+ && (d.applicationState === ApplicationInfoInterface.Running
296+ || d.applicationState === ApplicationInfoInterface.Starting)
288 }
297 }
289 ]
298 ]
290
299