### Godot version

v4.0.beta15.official [4fa6edc88]

### System information

Windows 11

### Issue description

When drawing a polygon in the editor, several duplicate vertices are added to the polygon array for each click.  In the image below, I clicked three times to draw the triangle, but got 10 entries.  The number you get varies, though I don't know why; I've seen hundreds of points from drawing a hexagon.  I tested it with a Polygon2D, a CollisionPolygon2D, and a CollisionPolygon3D; the issues occurs with all of them.  It later occurred to me that this might happen with a Curve2D as well, and it does.

![image](https://user-images.githubusercontent.com/2808851/214926182-b8609b87-85a1-4a08-8017-be4eeec912c6.png)


### Steps to reproduce

Add a node that has a Polygon or Curve resource, such as a Polygon2D, draw some points, then check the PackedVector2Array resource.

### Minimal reproduction project

N/A
return EditorNode::get_singleton()->get_edited_scene();
}
void EditorNode::_print_handler(void *p_this, const String &p_string, bool p_error, bool p_rich) {
	EditorNode *en = static_cast<EditorNode *>(p_this);
	if (p_error) {
		en->log->add_message(p_string, EditorLog::MSG_TYPE_ERROR);
	} else if (p_rich) {
		en->log->add_message(p_string, EditorLog::MSG_TYPE_STD_RICH);
	} else {
		en->log->add_message(p_string, EditorLog::MSG_TYPE_STD);
	}
}
static void _execute_thread(void *p_ud) {
	EditorNode::ExecuteThreadArgs *eta = (EditorNode::ExecuteThreadArgs *)p_ud;
	Error err = OS::get_singleton()->execute(eta->path, eta->args, &eta->output, &eta->exitcode, true, &eta->execute_output_mutex);
	print_verbose("Thread exit status: " + itos(eta->exitcode));
	if (err != OK) {
		eta->exitcode = err;
	}
	eta->done.set();
}
int EditorNode::execute_and_show_output(const String &p_title, const String &p_path, const List<String> &p_arguments, bool p_close_on_ok, bool p_close_on_errors) {
	execute_output_dialog->set_title(p_title);
	execute_output_dialog->get_ok_button()->set_disabled(true);
	execute_outputs->clear();
	execute_outputs->set_scroll_follow(true);
	execute_output_dialog->popup_centered_ratio();
	ExecuteThreadArgs eta;
	eta.path = p_path;
	eta.args = p_arguments;