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

Clicking on a button in Select Screen popup prints an error #96560

Open
Giganzo opened this issue Sep 4, 2024 · 14 comments
Open

Clicking on a button in Select Screen popup prints an error #96560

Giganzo opened this issue Sep 4, 2024 · 14 comments

Comments

@Giganzo
Copy link
Contributor

Giganzo commented Sep 4, 2024

Tested versions

4.4.dev1
4.1.2.stable

System information

Fedora Linux 40 (KDE Plasma) - Wayland - Vulkan (Forward+)

Issue description

When clicking on a button in this menu popup
Screenshot_20240904_121608

Prints this error:
platform/linuxbsd/x11/display_server_x11.cpp:2084 - Condition "prev_parent == p_parent" is true.

Similar error is printed on Windows too

Steps to reproduce

Right click on Make editor floating button
Click on one of the screen buttons
Error is printed in Output

Minimal reproduction project (MRP)

N/A

@Giganzo
Copy link
Contributor Author

Giganzo commented Sep 4, 2024

Error on Windows:

platform/windows/display_server_windows.cpp:1771 - Condition "wd_window.transient_parent == p_parent" is true.

@hunterkepley
Copy link
Contributor

I believe you are using x11 here, you need to go into editor settings and turn on prefer wayland or whatever the option is called (search Wayland)

I am unable to use this feature on wayland in general

@hunterkepley
Copy link
Contributor

image

@Giganzo
Copy link
Contributor Author

Giganzo commented Sep 4, 2024

I believe you are using x11 here, you need to go into editor settings and turn on prefer wayland or whatever the option is called (search Wayland)

I am unable to use this feature on wayland in general

No, this happen on Fedora 39 X11 too and Windows

@hunterkepley
Copy link
Contributor

hunterkepley commented Sep 4, 2024

@Giganzo the error is from the x11 display server: platform/linuxbsd/x11/display_server_x11.cpp:2084 - Condition "prev_parent == p_parent" is true.

@hunterkepley
Copy link
Contributor

hunterkepley commented Sep 4, 2024

on Wayland, the select screen button is greyed out:
image

At least for me (I am on fedora 39, KDE plasma wayland)

@Giganzo
Copy link
Contributor Author

Giganzo commented Sep 4, 2024

on Wayland, the select screen button is greyed out: image

At least for me

Yes, if prefer wayland is on. As it uses Single window mode if I understand it correctly.

@hunterkepley
Copy link
Contributor

Was mentioning this to make sure, that the issue is indeed with x11/windows, rather than wayland/windows

Will look into the error 😃

@hunterkepley
Copy link
Contributor

hunterkepley commented Sep 4, 2024

Something interesting; I printed the comparison causing the error (prev_parent and p_parent)

If you start godot after a pop-out window was in use, it will start with that pop-out window, and no error:

WARNING: prev: -1; parent: 0
     at: window_set_transient (platform/linuxbsd/x11/display_server_x11.cpp:2084

If you then close the popout and reopen it, you get the error, and neither the previous window, nor current window, can be found, resulting in equal IDs of -1

WARNING: prev: 0; parent: -1
     at: window_set_transient (platform/linuxbsd/x11/display_server_x11.cpp:2084)
WARNING: prev: -1; parent: 0
     at: window_set_transient (platform/linuxbsd/x11/display_server_x11.cpp:2084)
WARNING: prev: 0; parent: -1
     at: window_set_transient (platform/linuxbsd/x11/display_server_x11.cpp:2084)
WARNING: prev: -1; parent: -1
     at: window_set_transient (platform/linuxbsd/x11/display_server_x11.cpp:2084)
ERROR: Condition "prev_parent == p_parent" is true.
   at: window_set_transient (platform/linuxbsd/x11/display_server_x11.cpp:2085)

@hunterkepley
Copy link
Contributor

Going to leave this here, and hope someone else has an idea, i am unsure why it is getting 2 invalid window IDs for both the new window + the previous window, when it works on startup

@bikemurt
Copy link
Contributor

bikemurt commented Sep 5, 2024

A couple of notes:

  • This issue is present in both the script_editor_plugin.cpp and shader_editor_plugin.cpp. So we know it's upstream from there
    make_floating->connect("request_open_in_screen", callable_mp(window_wrapper, &WindowWrapper::enable_window_on_screen).bind(true));
  • I traced backwards from the error to here, but can't find how clicking on a "Select Screen" option calls _make_window():
    DisplayServer::get_singleton()->window_set_transient(E->window_id, transient_parent->window_id);

@bikemurt
Copy link
Contributor

bikemurt commented Sep 5, 2024

Still investigating, but this looks suspect to me:

wrapped_control->reparent(parent, false);

I think it's the transient_parent logic. By reparenting, I think we invalidate the window ID and that's what is generating the error. I don't know why this is necessary.

Here's the call stack in case it helps anyone else:
image

@bikemurt
Copy link
Contributor

bikemurt commented Sep 5, 2024

Going to leave this here, and hope someone else has an idea, i am unsure why it is getting 2 invalid window IDs for both the new window + the previous window, when it works on startup

The ID of 0 isn't invalid, it just means main window:

	enum {
		MAIN_WINDOW_ID = 0,
		INVALID_WINDOW_ID = -1,
		INVALID_INDICATOR_ID = -1
	};

I ran a similar test on Windows and I get these values on startup (inside window_set_transient):

wd_window.transient_parent: 0
p_parent: -1

wd_window.transient_parent: 0
p_parent: -1

Then when using the "Select Screen" option I get:

wd_window.transient_parent: 0
p_parent: -1

wd_window.transient_parent: -1
p_parent: -1

So technically it's only the 2nd pass that's causing the issue (transient parent and p_parent are both invalid). Haven't been able to trace what's driving that. Might be something to do with the popup.

One more update: I have been able to generate the error by selecting the Left click option to pop out the script editor, but it happens far less often. It's some weird timing thing with the transient parent and parent being out of sync for validation.

@bikemurt
Copy link
Contributor

bikemurt commented Sep 5, 2024

If you comment out this line, the error doesn't appear until the popup window is made hidden by losing focus:

button->connect(SceneStringName(pressed), callable_mp(static_cast<Window *>(popup), &Popup::hide));

Issue may actually be with the popup window's ID not being valid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants