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

Pass argc as reference to reinitializeAsQApplication (fixes #3367) #3370

Merged
merged 2 commits into from
Oct 9, 2023

Conversation

marceldev89
Copy link
Contributor

@marceldev89 marceldev89 commented Oct 9, 2023

Fixes crash caused by #3313

src/main.cpp Outdated
@@ -117,7 +117,7 @@ void configureApp(bool gui)

// TODO find a way so we don't have to do this
/// Recreate the application as a QApplication
void reinitializeAsQApplication(int argc, char* argv[])
void reinitializeAsQApplication(int &argc, char* argv[])
Copy link
Contributor

@veracioux veracioux Oct 9, 2023

Choose a reason for hiding this comment

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

@marceldev89 Nice catch. Though it looks to me that argv could conceivably fail in the same way. Can you replace it with char *(&argv)[]?
Edit: Nevermind, it's not necessary based on the signature of the QApplication constructor.

Copy link
Contributor Author

@marceldev89 marceldev89 Oct 9, 2023

Choose a reason for hiding this comment

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

@veracioux it shouldn't. The problem was the QApplication constructor signature which is QApplication(int &argc, char **argv). So it expects a reference to argc instead of the value. argv should be fine as char* argv[] is basically the same as char **argv I think :)

Edit: haha missed your edit, but yes 😛

Copy link
Contributor

@veracioux veracioux Oct 9, 2023

Choose a reason for hiding this comment

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

@marceldev89 Yup, very subtle and annoying. Please do a clang-format on the code, so our pipeline can pass before merge. Or just moving the & next to the int will probably do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you! Merging.

@veracioux veracioux merged commit f54d4c7 into flameshot-org:master Oct 9, 2023
22 of 23 checks passed
@mmahmoudian mmahmoudian added this to the v13 milestone Oct 10, 2023
panpuchkov pushed a commit to namecheap/flameshot that referenced this pull request Dec 22, 2023
…-org#3367) (flameshot-org#3370)

* Pass argc as reference to reinitializeAsQApplication (fixes flameshot-org#3367)

* Formatting

(cherry picked from commit f54d4c7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants