8000 fix for "handle is not inialized" crash on `clr.GetClrType(System.__class__)` by den-run-ai · Pull Request #607 · pythonnet/pythonnet · GitHub
[go: up one dir, main page]

Skip to content

fix for "handle is not inialized" crash on clr.GetClrType(System.__class__) #607

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 2 commits into from
Jan 31, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix for "handle is not inialized" crash on `clr.GetClrType(System.__c…
…lass__)`
  • Loading branch information
den-run-ai committed Jan 28, 2018
commit 16f05e51d894f230787af0e7f64ac29514ab46fd
6 changes: 5 additions & 1 deletion src/runtime/managedtype.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Runtime.InteropServices;

namespace Python.Runtime
Expand Down Expand Up @@ -34,6 +34,10 @@ internal static ManagedType GetManagedObject(IntPtr ob)
IntPtr op = tp == ob
? Marshal.ReadIntPtr(tp, TypeOffset.magic())
: Marshal.ReadIntPtr(ob, ObjectOffset.magic(ob));
if (op == IntPtr.Zero)
{
return null;
}
var gc = (GCHandle)op;
return (ManagedType)gc.Target;
}
Expand Down
0