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

[macOS] OS::create_process is not passing command line arguments correctly. #45153

Closed
bruvzg opened this issue Jan 13, 2021 · 1 comment · Fixed by #45155
Closed

[macOS] OS::create_process is not passing command line arguments correctly. #45153

bruvzg opened this issue Jan 13, 2021 · 1 comment · Fixed by #45155
Milestone

Comments

@bruvzg
Copy link
Member

bruvzg commented Jan 13, 2021

Godot version:
master, 7f8ab37

OS/device including version:
macOS 11.1

Issue description:
Project Manager is no longer opening projects, since command line arguments are not passed to the editor child process correctly. Opening project fails with the following log (and open another instance of project manager instead), arguments contain random garbage:

Editing project: /Users/bruv/Documents/__godot_control_test_projects/fff (::Users::bruv::Documents::__godot_control_test_projects::fff)
arguments
0: P�U��
1:
2: P�U��
3:
Current path: /Users/bruv/Documents/godot
Unicode parsing error: invalid skip at 1. Is the string valid UTF-8?

Regression from #44514

Steps to reproduce:
Open new or existing project from project manager.

@bruvzg
Copy link
Member Author

bruvzg commented Jan 13, 2021

Issue is caused by removing this part:

		Vector<CharString> cs;
		cs.push_back(p_path.utf8());
		for (int i = 0; i < p_arguments.size(); i++) {
			cs.push_back(p_arguments[i].utf8());
		}

New code is freeing CharString created by utf8 and making char* ptr invalid on each iteration:

		for (int i = 0; i < p_arguments.size(); i++) {
			args.push_back((char *)p_arguments[i].utf8().get_data());
		}

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.

1 participant