[AudioUnit] Only create the GCHandle to self when we need it. (#13397)
This commit is contained in:
Родитель
72c369ad7e
Коммит
faa966ba20
|
@ -312,7 +312,6 @@ namespace AudioUnit
|
|||
internal AudioUnit (IntPtr handle, bool owns)
|
||||
: base (handle, owns)
|
||||
{
|
||||
gcHandle = GCHandle.Alloc(this);
|
||||
}
|
||||
|
||||
static IntPtr Create (AudioComponent component)
|
||||
|
@ -601,6 +600,9 @@ namespace AudioUnit
|
|||
|
||||
renderer [audioUnitElement] = renderDelegate;
|
||||
|
||||
if (!gcHandle.IsAllocated)
|
||||
gcHandle = GCHandle.Alloc (this);
|
||||
|
||||
var cb = new AURenderCallbackStruct ();
|
||||
cb.Proc = CreateRenderCallback;
|
||||
cb.ProcRefCon = GCHandle.ToIntPtr (gcHandle);
|
||||
|
|
Загрузка…
Ссылка в новой задаче