diff --git a/OpenDreamRuntime/DreamThread.cs b/OpenDreamRuntime/DreamThread.cs index 6f23064695..011c233ee1 100644 --- a/OpenDreamRuntime/DreamThread.cs +++ b/OpenDreamRuntime/DreamThread.cs @@ -211,10 +211,8 @@ public static DreamValue Run(DreamProc proc, DreamObject src, DreamObject? usr, var context = new DreamThread(proc.ToString()); if (proc is NativeProc nativeProc) { - var zone = Profiler.BeginZone(filePath:"Native Proc", lineNumber:0, memberName:nativeProc.Name); - var result = nativeProc.Call(context, src, usr, new(arguments)); - zone?.Dispose(); - return result; + using(Profiler.BeginZone(filePath:"Native Proc", lineNumber:0, memberName:nativeProc.Name)) + return nativeProc.Call(context, src, usr, new(arguments)); } var state = proc.CreateState(context, src, usr, new DreamProcArguments(arguments)); diff --git a/OpenDreamRuntime/Procs/DMProc.cs b/OpenDreamRuntime/Procs/DMProc.cs index 189068a4d1..db8be3b231 100644 --- a/OpenDreamRuntime/Procs/DMProc.cs +++ b/OpenDreamRuntime/Procs/DMProc.cs @@ -488,9 +488,8 @@ public void SetReturn(DreamValue value) { public ProcStatus Call(DreamProc proc, DreamObject? src, DreamProcArguments arguments) { if (proc is NativeProc p) { // Skip a whole song and dance. - var zone = Profiler.BeginZone(filePath:"Native Proc", lineNumber:0, memberName:p.Name); - Push(p.Call(Thread, src, Usr, arguments)); - zone?.Dispose(); + using(Profiler.BeginZone(filePath:"Native Proc", lineNumber:0, memberName:p.Name)) + Push(p.Call(Thread, src, Usr, arguments)); return ProcStatus.Continue; }