We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8f04692 commit 628aa39Copy full SHA for 628aa39
src/Java.Interop/Java.Interop/JniObjectReferenceControlBlock.cs
@@ -0,0 +1,25 @@
1
+using System;
2
+using System.Runtime.InteropServices;
3
+
4
+namespace Java.Interop;
5
6
+internal struct JniObjectReferenceControlBlock {
7
+ public IntPtr handle;
8
+ public int handle_type;
9
+ public IntPtr weak_handle;
10
+ public int refs_added;
11
12
+ public static readonly int Size = Marshal.SizeOf<JniObjectReferenceControlBlock>();
13
14
+ public static unsafe IntPtr Alloc () =>
15
+ (IntPtr) NativeMemory.AllocZeroed (1, (uint) Size);
16
17
+ public static unsafe void Free (ref IntPtr value)
18
+ {
19
+ if (value == 0) {
20
+ return;
21
+ }
22
+ NativeMemory.Free ((void*) value);
23
+ value = IntPtr.Zero;
24
25
+}
0 commit comments