mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-23 10:25:34 +00:00
Value: Don't try to marshal if type has no StructLayout
If the StructLayout is not set, StructureToPtr will throw an exception. In these cases the type is probably wrapped using a handle and thus needs no update.
This commit is contained in:
parent
1fab57eeac
commit
280087e431
|
@ -576,6 +576,10 @@ namespace GLib {
|
|||
if (GType.Is (type, GType.Boxed) && !(val is IWrapper)) {
|
||||
MethodInfo mi = val.GetType ().GetMethod ("Update", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
IntPtr boxed_ptr = g_value_get_boxed (ref this);
|
||||
|
||||
if (mi == null && !val.GetType ().IsDefined (typeof(StructLayoutAttribute), false))
|
||||
return;
|
||||
|
||||
if (mi == null)
|
||||
Marshal.StructureToPtr (val, boxed_ptr, false);
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue