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

Fix two signal errors, remove unused break_request signals in profilers #36340

Merged
merged 1 commit into from
Feb 20, 2020

Conversation

nathanfranke
Copy link
Contributor

This change fixes two errors I found while running the latest master. Not sure when they came about


This signal just doesn't exist. I added it, but it currently is never emitted. Keeping it to be consistent with the other profiler classes

ERROR: In Object of type 'EditorNetworkProfiler': Attempt to connect nonexistent signal 'break_request' to method 'ScriptEditorDebugger._profiler_seeked'.
   at: connect (core/object.cpp:1452)

Calling for @rxlecky who authored #27742

(?) Not sure exactly what was happening here. Presumably call_deferred takes a vararg (Vector) but the connect will mess up if the binds argument is another vararg.

Once connect was called, the first value in p_args was Nil, now it correctly holds true/false

ERROR: Error calling method from signal 'play_pressed': 'CanvasItemEditor::_update_override_camera_button': Cannot convert argument 1 from Nil to bool..
   at: emit_signal (core/object.cpp:1228)

@akien-mga akien-mga requested a review from JFonS February 19, 2020 08:30
@akien-mga akien-mga added this to the 4.0 milestone Feb 19, 2020
@akien-mga akien-mga added the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Feb 19, 2020
@JFonS
Copy link
Contributor

JFonS commented Feb 19, 2020

I don't think the fix for NetworkProfiler is correct, "break_request" is never used as a signal in that class so it should not be defined there. Instead we should remove the connect attempt.

I tried looking for the connect code but I could not find it, not sure what is going on here... A full project search for "break_request" shows the 3 usages related to EditorProfiler and nothing else, so I'm quite puzzled by that.

@akien-mga
Copy link
Member

akien-mga commented Feb 19, 2020

@JFonS Your grep-fu failed you ;) It's connected in script_editor_debugger.cpp:

$ rg "break_request"
editor/editor_profiler.cpp
554:                                    emit_signal("break_request");
613:    ADD_SIGNAL(MethodInfo("break_request"));

editor/editor_visual_profiler.cpp
592:                                    //emit_signal("break_request");
682:    ADD_SIGNAL(MethodInfo("break_request"));

editor/script_editor_debugger.cpp
2503:           profiler->connect("break_request", this, "_profiler_seeked");
2511:           visual_profiler->connect("break_request", this, "_profiler_seeked");
2519:           network_profiler->connect("break_request", this, "_profiler_seeked");

The visual profiler also never emits the signal BTW, so it's also buggy.

@JFonS
Copy link
Contributor

JFonS commented Feb 19, 2020

Well... turns out pulling from upstream before searching is a wise decision.

I'm not sure why @reduz added the connect call there, but I think it is safe to remove it.

@nathanfranke
Copy link
Contributor Author

I will push an update in about ten minutes, I may remove visual_profiler->connect since it also seems to be unused (As long as my tests work fine).

@nathanfranke nathanfranke changed the title Fix two signal errors Fix two signal errors, remove unused break_request signals in profilers Feb 19, 2020
@akien-mga akien-mga merged commit 353e207 into godotengine:master Feb 20, 2020
@akien-mga
Copy link
Member

Thanks!

editor->call_deferred("connect", "play_pressed", this, "_update_override_camera_button", make_binds(true));
editor->call_deferred("connect", "stop_pressed", this, "_update_override_camera_button", make_binds(false));
editor->call_deferred("connect", make_binds("play_pressed", this, "_update_override_camera_button", true));
editor->call_deferred("connect", make_binds("stop_pressed", this, "_update_override_camera_button", false));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not seem correct to me. make_binds creates a Vector<Variant> out of the arguments passed to the function. However, there is no overload of connect function that would take a single parameter of type Vector<Variant>.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think MessageQueue (backend of call deferred) uses a Vector. Ideally we should fix varargs since they are poorly implemented :| that's something I need to work on in C++

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MessageQueue::push_call - the overload that Object::call_deferred calls - uses VARIANT_ARG for passing message parameters, not Vector.

@rxlecky
Copy link
Contributor

rxlecky commented Feb 20, 2020

I dug into this a little and tested your solution and as it turns out, it only silences the error but doesn't solve the issue. By packing the parameters into Vector<Variant>, which doesn't match the parameters of connect, the function call fails and the signal is never connected. However, it fails silently since the overload of push_call that call_deferred uses, suppresses the errors.

@rxlecky
Copy link
Contributor

rxlecky commented Feb 21, 2020

Eventually, I found the culprit here was Variant to Vector conversion operator. There were changes made to Variant class recently and a small typo made it in (PR #36404). It turns out this conversion function gets used rarely so it slipped the attention and exhibited here as a failed signal call.

I suggest reverting the latter of your changes back to original once #36404 is merged as it should work correctly again.

@nathanfranke
Copy link
Contributor Author

nathanfranke commented Feb 21, 2020

@rxlecky Would you like to make a commit that reverts my changes to canvas_item_editor_plugin.cpp and fixes any other problems since I have no idea what is happening right now?

@rxlecky
Copy link
Contributor

rxlecky commented Feb 21, 2020

Also a heads-up to @akien-mga not to cherry-pick this one to 3.2 just yet :)

@rxlecky
Copy link
Contributor

rxlecky commented Feb 21, 2020

@nathanwfranke oh, it's literally just turning the lines 5416 and 5417 back to what they were before:

editor->call_deferred("connect", "play_pressed", this, "_update_override_camera_button", make_binds(true));
editor->call_deferred("connect", "stop_pressed", this, "_update_override_camera_button", make_binds(false));

I can make the commit if you like, I just thought you'd prefer to do it yourself since it's your PR.

@aaronfranke aaronfranke removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Feb 21, 2020
@nathanfranke
Copy link
Contributor Author

Tried that, there is a conflict with #35864. Still not sure if I should say connect or connect_compat because that was another conflict. I will do the revert just let me know if anything is incorrect

@rxlecky
Copy link
Contributor

rxlecky commented Feb 21, 2020

The conflict with #35864 is truly strange since it doesn't even touch the same files.

Oh, you are right, I completely forgot about #36368 that got merged soon after your PR. The lines should be as follows to accommodate for the change

editor->call_deferred("connect", "play_pressed", Callable(this, "_update_override_camera_button"), make_binds(true));
editor->call_deferred("connect", "stop_pressed", Callable(this, "_update_override_camera_button"), make_binds(false));

Also, I did not mean to intimidate you in any way, I'm really sorry if that was the case. On the contrary, I'm happy to give a hand or explain if you don't understand something. Just be sure to speak up 🙂

@nathanfranke
Copy link
Contributor Author

@rxlecky No problem, I put that in the pull request above your comment. Also thanks for the heads up but I figured it out. It's good practice for me anyways.

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

Successfully merging this pull request may close these issues.

5 participants