Repository navigation
Conversation
or field accessors - those were not created in the shell classes, and the shell classes were not used for that (this might be a remnant of the original Java wrapper generator). Instead require additionally that the destructor is virtual. Otherwise the wrong destructor will be called for objects created from Python.
(this method isn't currently used anymore, though)
|
|
||
| bool AbstractMetaClass::hasProtectedConstructors() const | ||
| { | ||
| return queryFunctions(Constructors | WasProtected).size() != 0; |
Contributor
There was a problem hiding this comment.
size() != 0 is a bit strange. I would expect size() > 0, or better !isEmpty().
A matter of taste, I guess...
| { | ||
| for (const AbstractMetaField* field : fields()) { | ||
| if (field->getter() || field->setter()) | ||
| if (field->isPublic() && (field->getter() || field->setter())) |
Contributor
There was a problem hiding this comment.
If it's not used, why not just remove it?
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Shell classes are a mechanism in generated wrapper code by which Python code can override virtual methods of wrapped classes. They are derived from the wrapped classes and override all virtual methods to first look for a Python implementation.
We have now noticed that these shell classes are also generated for classes that are not virtual at all. This has the big problem that the destructor of such an overridden class also is not virtual, so that that the destructor of such a shell class is never called, just the destructor of the base class. Also the shell classes didn't serve any purpose, since there were no virtual functions. (This is not the whole truth, the shell classes were also needed if there were protected constructors one wanted to use in a derived class, but a virtual destructor is still a hard requirement for a shell class to work correctly.)
The fix is to change the condition on which shell classes are generated to include a check if the destructor is virtual, and some other condition fixes. The PR also contains some minor related clean-ups.
I compared the generated wrappers for Qt 6.11.2 with the previous state, and didn't notice any problematic omissions of shell classes.