@@ -296,7 +296,7 @@ AbstractStage {
296 target: model.application
296 target: model.application
297 onFocusRequested: {
297 onFocusRequested: {
298 if (!model.surface) {
298 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:
300 // this delegate.
300 // this delegate.
301 claimFocus();
301 claimFocus();
@@ -311,6 +311,12 @@ AbstractStage {
312 if (focus) {
312 if (focus) {
313 priv.focusedAppDelegate = appDelegate;
313 priv.focusedAppDelegate = appDelegate;
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
318+ topLevelSurfaceList.raiseId(model.id);
314 } else if (!focus && priv.focusedAppDelegate === appDelegate) {
320 } else if (!focus && priv.focusedAppDelegate === appDelegate) {
315 priv.focusedAppDelegate = null;
321 priv.focusedAppDelegate = null;
316 // FIXME: No idea why the Binding{} doens't update when focusedAppDelegate turns null
322 // FIXME: No idea why the Binding{} doens't update when focusedAppDelegate turns null