Repository: godot
Issue: Core/object emit_signal method doesn't use default argument values when calling method
Labels: bug,topic:core,regression

### Godot version

v4.0.dev.custom_build [7607477d1]

### System information

Ubuntu 20.04.2

### Issue description

I'm developing a minor new engine feature, but ran into this issue when I implemented it on the master branch (it worked with no issues on 3.x and 3.3.2-stable).
The feature involves adding an argument to an existing method with a default value defined in the class header file and _bind_methods() function.

The method in question (`queue_sort`) looks like this (the code shown is exactly the same as the 3.x implementation, which worked fine):
```
//container.cpp
void Container::queue_sort(bool p_ignore_sort_disabled) {}
void Container::_bind_methods() {
	ClassDB::bind_method(D_METHOD("queue_sort", "ignore_sort_disabled"), &Container::queue_sort, DEFVAL(false));

//container.h
protected:
	void queue_sort(bool p_ignore_sort_disabled = false);
```

After re-implementing the changes on master, the method is immediately called by existing emit_signal call(s) which causes the following error:
`ERROR: Error calling from signal 'size_flags_changed' to callable: Container::queue_sort : Method expected 1 arguments, but called with 0..
   at: emit_signal (core/object/object.cpp:1111)
`

In addition, the engine crashes with this backtrace when opening any project:
```
handle_crash: Program crashed with signal 11
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x46210) [0x7fe6d7374210] (??:0)
[2] Ref<Texture2D>::operator!=(Ref<Texture2D> const&) const (/home/user/godot/./core/object/ref_counted.h:97)
[3] Button::set_icon(Ref<Texture2D> const&) (/home/user/godot/scene/gui/button.cpp:419)
[4] EditorLog::_add_log_line(EditorLog::LogMessage&, bool) (/home/user/godot/editor/editor_log.cpp:254)
[5] EditorLog::_process_message(String const&, EditorLog::MessageType) (/home/user/godot/editor/editor_log.cpp:186)
[6] EditorLog::add_message(String const&, EditorLog::MessageType) (/home/user/godot/editor/editor_log.cpp:200 (discriminator 3))
[7] EditorLog::_error_handler(void*, char const*, char const*, int, char const*, char const*, ErrorHandlerType) (/home/user/godot/editor/editor_log.cpp:46)
[8] _err_print_error(char const*, char const*, int, char const*, char const*, ErrorHandlerType) (/home/user/godot/core/error/error_macros.cpp:82)
[9] _err_print_error(char const*, char const*, int, String const&, ErrorHandlerType) (/home/user/godot/core/error/error_macros.cpp:73 (discriminator 4))
[10] Object::emit_signal(StringName const&, Variant const**, int) (/home/user/godot/core/object/object.cpp:1111 (discriminator 17))
[11] Object::emit_signal(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) (/home/user/godot/core/object/object.cpp:1155)
[12] Control::set_v_size_flags(int) (/home/user/godot/scene/gui/control.cpp:2322)
[13] EditorNode::add_bottom_panel_item(String, Control*) (/home/user/godot/editor/editor_node.cpp:5023 (discriminator 10))
[14] EditorNode::EditorNode() (/home/user/godot/editor/editor_node.cpp:6689 (discriminator 5))
[15] Main::start() (/home/user/godot/main/main.cpp:2189)
[16] /home/user/godot/bin/godot.linuxbsd.tools.64(main+0x153) [0x2102bb9] (/home/user/godot/platform/linuxbsd/godot_linuxbsd.cpp:57)
[17] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7fe6d73550b3] (??:0)
[18] /home/user/godot/bin/godot.linuxbsd.tools.64(_start+0x2e) [0x21029ae] (??:?)
-- END OF BACKTRACE --
```
The backtrace shows that the emit_signal call causing the issue is this:
```
//control.cpp
void Control::set_v_size_flags(int p_flags) {
	if (data.v_size_flags == p_flags) {
		return;
	}
	data.v_size_flags = p_flags;
	emit_signal(SceneStringNames::get_singleton()->size_flags_changed);
}
```

Disclaimer: I'm a complete C++ noob, so there's a good chance I'm doing something completely wrong here.

### Steps to reproduce

Checkout to master
Add a new argument with default value to a method called by a signal
Engine crashes and/or pushes errors at runtime because the method doesn't get called with the default arguments

### Minimal reproduction project

Broken master implementation: https://github.com/spectreseven1138/godot/commit/7607477d11cbc60231d9645b99a12f9b1fbe63e4
Working 3.x implementation: https://github.com/spectreseven1138/godot/commit/4cc2ce8527043a078d501a62a8a81221bfa9830a