@@ -296,7 +296,7 @@ AbstractStage {
296296 target: model.application
297297 onFocusRequested: {
298298 if (!model.surface) {
299− // when an app has no surfaces, we assume there's only one entry representing it,
299+ // when an app has no surfaces, we assume there's only one entry representing it:
300300 // this delegate.
301301 claimFocus();
302302 } else {
@@ -311,6 +311,12 @@ AbstractStage {
311311
312312 if (focus) {
313313 priv.focusedAppDelegate = appDelegate;
314+
315+ // If we're orphan (!parent) it means this stage is no longer the current one
316+ // and will be deleted shortly. So we should no longer have a say over the model
317+ if (root.parent) {
318+ topLevelSurfaceList.raiseId(model.id);
319+ }
314320 } else if (!focus && priv.focusedAppDelegate === appDelegate) {
315321 priv.focusedAppDelegate = null;
316322 // FIXME: No idea why the Binding{} doens't update when focusedAppDelegate turns null