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

"Parent node is busy setting up children" on focus loss when save_on_focus_loss option is enabled #73765

Closed
akien-mga opened this issue Feb 22, 2023 · 15 comments · Fixed by #91555

Comments

@akien-mga
Copy link
Member

akien-mga commented Feb 22, 2023


Bugsquad note: This issue has been confirmed several times already. No need to confirm it further.


Godot version

4.0.rc (5f3dee5)

System information

Mageia 9, Linux

Issue description

When interface/editor/save_on_focus_loss is enabled in the Editor Settings, focus loss triggers a save as expected, but also these errors:

ERROR: Parent node is busy setting up children, `add_child()` failed. Consider using `add_child.call_deferred(child)` instead.
   at: add_child (scene/main/node.cpp:1136)
ERROR: Condition "!is_inside_tree()" is true.
   at: popup_centered (scene/main/window.cpp:1456)

Steps to reproduce

  • Enable interface/editor/save_on_focus_loss
  • Alt tab to desktop and back

Minimal reproduction project

Happens on an empty project.

Production edit (keywords for easier searching): Task 'save' already exists.

@Rindbee
Copy link
Contributor

Rindbee commented Feb 26, 2023

case NOTIFICATION_APPLICATION_FOCUS_IN:
case NOTIFICATION_APPLICATION_FOCUS_OUT: {
// Pass these to nodes, since they are mirrored.
get_root()->propagate_notification(p_notification);
} break;

godot/scene/main/node.cpp

Lines 1924 to 1932 in 84a8072

void Node::propagate_notification(int p_notification) {
data.blocked++;
notification(p_notification);
for (int i = 0; i < data.children.size(); i++) {
data.children[i]->propagate_notification(p_notification);
}
data.blocked--;
}

EditorNode *ed = EditorNode::get_singleton();
if (ed && !is_inside_tree()) {
Window *w = ed->get_window();
while (w && w->get_exclusive_child()) {
w = w->get_exclusive_child();
}
if (w && w != this) {
w->add_child(this);
popup_centered(ms);
}
}

propagate_notification(NOTIFICATION_APPLICATION_FOCUS_OUT) causes data.blocked to be greater than 0, and finally the root window fails to add the ProgressDialog as a child node.

It seems that new child nodes cannot be added to the parent node during propagate_notification.

@rayzorite
Copy link

This is still not fixed and is available in Godot 4.1

@iseos
Copy link

iseos commented Sep 26, 2023

The error is also present in v4.2-dev5

@jbromberg
Copy link

Also encountering this issue - frustrating

@ClassyCircuit
Copy link

I have the same issue in v4.1.2.
Do you think this will be prioritized any time soon?

@thygrrr
Copy link
Contributor

thygrrr commented Oct 14, 2023

Disabling Save on Focus Lost is a workaround, of course you lose the ability to save on focus lost.

@ClassyCircuit
Copy link

Disabling Save on Focus Lost is a workaround, of course you lose the ability to save on focus lost.

That's not a workaround, it's just a broken feature.

@rayzorite
Copy link

I have the same issue in v4.1.2.
Do you think this will be prioritized any time soon?

i don't think so unless some big shot on twitter or youtube spread it and its not really a big deal for some people so i dont think this will be fixed anytime soon

@thygrrr
Copy link
Contributor

thygrrr commented Oct 14, 2023

Disabling Save on Focus Lost is a workaround, of course you lose the ability to save on focus lost.

That's not a workaround, it's just a broken feature.

It works around the error, which automated testing would flag as an error.

It surely doesn't fix the cause.

@Calinou
Copy link
Member

Calinou commented Oct 14, 2023

propagate_notification(NOTIFICATION_APPLICATION_FOCUS_OUT) causes data.blocked to be greater than 0, and finally the root window fails to add the ProgressDialog as a child node.

The solution is likely to add a way to save all scenes/scripts in the editor without displaying a progress dialog, and use this when Save on Focus Loss is triggered.

Alternatively, we can get rid of the progress dialog when saving and move this to a non-blocking control displayed at the bottom of the editor (similar to a toast, though not the exact same). For instance, when saving a file, LibreOffice replaces its status bar at the bottom with a save progress bar:

image

I'd personally prefer this approach as I find the progress dialog on save distracting. We only need to keep it for operations that need to be blocking to avoid data inconsistency, such as resource importing.

@MasterBroNetwork
Copy link

This error is still occurring as of Godot v4.1.3-stable in the exact same manner, I agree with Calinou that a different way to show saving would be great, I also have found the dialog to be quite distracting but this error makes my output log ridiculously noisy over-time as I work on my project, I have had to disable Save on Focus Lost due to this issue as it has become frustrating to debug while this is occurring.

An option to temporarily hide internal editor errors during playtesting would be great so that my output is not cluttered by errors like this.

@Wolve-3DTech
Copy link

I've encountered the same issue in Godot 4.2.1 stable...

@lemilonkh
Copy link
Contributor

Also encountering this on EndeavourOS with Godot 4.2.1.
Thankfully this issue told me what's going on, as without a debug build of the editor you just get this error message without further detail:

ERROR: Task 'save' already exists.
   at: add_task (editor/progress_dialog.cpp:167)
WARNING: ObjectDB instances leaked at exit (run with --verbose for details).
     at: cleanup (core/object/object.cpp:2208)
ERROR: Resources still in use at exit (run with --verbose for details).
   at: clear (core/io/resource.cpp:493)
[1]    3340289 segmentation fault (core dumped)  ~/Tools/Godot_v4.2.1-stable_linux.x86_64 --editor

With the first two lines being repeated a lot. Would be helpful to either flag this as broken on linux with a warning on the settings or at least have more helpful error output. I was wondering for half an hour or so why my editor always crashed when I launched the game - turns out it's the save on focus loss instead of anything related to my code.

@FathiMahdi
Copy link

Any progress on this bug, it still available on version 4.2.1

@calebhk98
Copy link

Still an issue on 4.2.2 stable. While a fix would be appreciated, it should probably add to the log that the issue is from save on Focus Lost, that way we have less wasted time debugging code that is not relevant.

AlexanderFarkas added a commit to AlexanderFarkas/godot that referenced this issue May 4, 2024
AlexanderFarkas added a commit to AlexanderFarkas/godot that referenced this issue May 4, 2024
AlexanderFarkas added a commit to AlexanderFarkas/godot that referenced this issue May 4, 2024
AlexanderFarkas added a commit to AlexanderFarkas/godot that referenced this issue May 8, 2024
@akien-mga akien-mga modified the milestones: 4.x, 4.3 May 8, 2024
ev1313 pushed a commit to ev1313/godot that referenced this issue May 8, 2024
huwpascoe pushed a commit to huwpascoe/godot that referenced this issue May 10, 2024
dimitry- pushed a commit to AndroidWasm/godot that referenced this issue May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.