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

Add workaround for SafeRegistryHandle marshalling issue in System.Speech. #169

Closed
wants to merge 1 commit into from

Conversation

shaunren
Copy link

Currently, in Mono, the COM interface pointer of the SafeRegistryHandle is passed to the native method, rather than the underlying handle.

@shaunren shaunren force-pushed the speech-reghandle-fix branch from cab2c93 to 78cf3be Compare October 11, 2023 17:59
@shaunren shaunren force-pushed the speech-reghandle-fix branch from 78cf3be to 2b84335 Compare October 11, 2023 18:03
@madewokherd
Copy link
Owner

That's odd, Mono should handle this.

@madewokherd
Copy link
Owner

Can you check whether this change in Mono fixes it?

diff --git a/mono/metadata/cominterop.c b/mono/metadata/cominterop.c
index 227045d7367..bd634e0bf4c 100644
--- a/mono/metadata/cominterop.c
+++ b/mono/metadata/cominterop.c
@@ -1028,6 +1028,11 @@ cominterop_class_marshalled_as_interface (MonoClass* klass)
        if (MONO_CLASS_IS_INTERFACE_INTERNAL (klass))
                return TRUE;
 
+       // subclasses of SafeHandle should use default marshaling
+       if (mono_class_try_get_safehandle_class () != NULL &&
+               mono_class_is_subclass_of_internal (klass,  mono_class_try_get_safehandle_class (), FALSE))
+               return FALSE;
+
        // Classes are marshalled as interfaces if their layout is not specified explicitly
        if (mono_class_is_auto_layout (klass))
                return TRUE;

@shaunren
Copy link
Author

This patch works as well.

@shaunren shaunren closed this Oct 11, 2023
@madewokherd
Copy link
Owner

Should be fixed in Wine Mono 8.1.0, which will be in Wine 8.19. I also pushed that update to Proton Experimental bleeding-edge.

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