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

Use "friend" to avoid leaking protected methods in #[cxxqt::inherit] #452

Closed
LeonMatthesKDAB opened this issue Feb 22, 2023 · 2 comments
Closed
Labels
🤔 discussion Feedback welcome ⬆️ feature New feature or request

Comments

@LeonMatthesKDAB
Copy link
Collaborator

Our current implementation of inheritance (#330) in #363 creates a public method for each inherited protected method.

We could avoid this by marking the CXX Wrapper method as a friend of the class.
This would however require us to generate the exact function signature, which may be difficult, especially if we update our CXX version, unless we can get access to CXX's generation somehow.

See: #329

@ahayzen-kdab
Copy link
Collaborator

We won't be able to get access to it in CXX, i already asked this upstream. They said to put this in a separate crate and then if it's popular they might accept (so we could split this and the C++ type generation into cxx-qt-utils or something, see #1144 for that).

So then the question for this becomes which is better

  • Marking the protected methods as public, so C++ can see methods it shouldn't, but the generation is easy and always correct
  • Using friend to reach the methods, so C++ is correct and can't see the methods, but the generation is harder and could break in the future.

@LeonMatthesKDAB
Copy link
Collaborator Author

Blocked by upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤔 discussion Feedback welcome ⬆️ feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants