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

Fix segfault on m1 #828

Merged
merged 1 commit into from
Aug 31, 2022
Merged

Conversation

Mark3K
Copy link
Contributor

@Mark3K Mark3K commented Aug 31, 2022

Fix #816
I don't know why the client from this API(IOHIDEventSystemClientCreate) is auto released(that's why I create the client every time refresh the components)
so I manually retain the client, it seems fix the segmentation fault

Some(c) => c,
None => return,
};
CFRetain(client.inner() as _);
Copy link
Owner

Choose a reason for hiding this comment

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

I think the original issue was because of self.client.replace(client);. Did you test without this call to CFRetain? If not, can you quickly check it please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, at first I think it was because of self.client.replace(client) too, and I did the test, it's not.
and from this crash report
it seems it is the dispatch_worker trying to release the client

Copy link
Owner

Choose a reason for hiding this comment

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

How weird... Oh well, that answers my question at least. Can you add a comment above the call to CFRetain saying something like this:

// Without this call, client is freed during the execution of the program. It must be kept!

@GuillaumeGomez
Copy link
Owner

Thanks for this! Just one thing to try out on your side and then I think we're all good. :)

@Mark3K Mark3K force-pushed the fix-segfault-on-m1 branch from 195ce09 to dbd169f Compare August 31, 2022 14:52
@GuillaumeGomez
Copy link
Owner

Perfect, thanks! Once CI pass, I'll merge and make a new release.

@GuillaumeGomez GuillaumeGomez merged commit c796196 into GuillaumeGomez:master Aug 31, 2022
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.

BUG: segfault when getting memory info on M1
2 participants