Skip to content

Convert virtualbase wrapper functions to friend functions #172

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

Merged
merged 3 commits into from
Feb 8, 2025

Conversation

mappu
Copy link
Owner

@mappu mappu commented Feb 8, 2025

Updates: #147

Updates: #166

Miqt supported calling the base/super method of any virtual override function. This worked by (A) creating a virtualbase_... method wrapper in the subclass, and (B) also adding a C ABI function to call it.

Combine these into a single C ABI function, following the friend pattern of the new protected-method support. This reduces the number of functions generated in the translation unit.

@mappu mappu force-pushed the miqt-friend-virtuals branch from 30cd66e to aa6a401 Compare February 8, 2025 01:43
@mappu mappu merged commit 2c04594 into master Feb 8, 2025
16 checks passed
@mappu mappu deleted the miqt-friend-virtuals branch February 8, 2025 02:09
@@ -534,7 +496,9 @@ bool QsciAbstractAPIs_override_virtual_event(void* self, intptr_t slot) {
}

bool QsciAbstractAPIs_virtualbase_event(void* self, QEvent* event) {
return ( (MiqtVirtualQsciAbstractAPIs*)(self) )->virtualbase_event(event);

return ( (MiqtVirtualQsciAbstractAPIs*)(self) )->MiqtVirtualQsciAbstractAPIs::event(event);
Copy link
Contributor

Choose a reason for hiding this comment

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

oops, instead of calling the base class function, this actually calls the override version which goes on to call the language override in a nice infinite recursion ;)

This needs to be ( (MiqtVirtualQsciAbstractAPIs*)(self) )->QsciAbstractAPIs::event(event) + argument conversion

Copy link
Owner Author

Choose a reason for hiding this comment

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

The c.ClassName reference was right, but it got caught up in the fixupProtectedReferences logic. Probably it will need to be teased apart so that it still builds on Android.

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.

2 participants