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

Mac: Fix some events not firing properly #2665

Merged
merged 1 commit into from
Jun 14, 2024

Conversation

cwensley
Copy link
Member

@cwensley cwensley commented Jun 14, 2024

In some cases, especially when the object being attached such as an NSScrollView.ContentView gets GC'd before it gets a chance to register, it would fail causing scroll events to not fire. This is because we were (incorrectly) using Runtime.TryGetNSObject() which will only return an object if it still has a managed instance.

Additionally if we were to add an event after the control is loaded it wouldn't register it properly so we only delay registration before it has been loaded.

Now we use Runtime.GetNSObject() so it'll create an instance if necessary.

This issue was caused by #2654 as now we only add notification centre observers when the control is loaded, giving more time for the .NET instance to be GC'd if it isn't referenced anywhere.

@cwensley cwensley added the bug label Jun 14, 2024
@cwensley cwensley added this to the 2.8.4 milestone Jun 14, 2024
@cwensley cwensley merged commit cbbb2e5 into picoe:develop Jun 14, 2024
3 checks passed
@cwensley cwensley deleted the curtis/mac-fix-events-in-release branch June 14, 2024 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant