[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)
|
internal AudioUnit (IntPtr handle, bool owns)
|
||||||
: base (handle, owns)
|
: base (handle, owns)
|
||||||
{
|
{
|
||||||
gcHandle = GCHandle.Alloc(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static IntPtr Create (AudioComponent component)
|
static IntPtr Create (AudioComponent component)
|
||||||
|
@ -601,6 +600,9 @@ namespace AudioUnit
|
||||||
|
|
||||||
renderer [audioUnitElement] = renderDelegate;
|
renderer [audioUnitElement] = renderDelegate;
|
||||||
|
|
||||||
|
if (!gcHandle.IsAllocated)
|
||||||
|
gcHandle = GCHandle.Alloc (this);
|
||||||
|
|
||||||
var cb = new AURenderCallbackStruct ();
|
var cb = new AURenderCallbackStruct ();
|
||||||
cb.Proc = CreateRenderCallback;
|
cb.Proc = CreateRenderCallback;
|
||||||
cb.ProcRefCon = GCHandle.ToIntPtr (gcHandle);
|
cb.ProcRefCon = GCHandle.ToIntPtr (gcHandle);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче