From 262c3f1b4f6668ad70cd92b322f7777973221cf5 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Thu, 16 Oct 2025 13:10:33 +0200 Subject: [PATCH] Wrap remaining Pipe access in lock --- FFMpegCore/FFMpeg/Arguments/PipeArgument.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/FFMpegCore/FFMpeg/Arguments/PipeArgument.cs b/FFMpegCore/FFMpeg/Arguments/PipeArgument.cs index 69fd990..0e51947 100644 --- a/FFMpegCore/FFMpeg/Arguments/PipeArgument.cs +++ b/FFMpegCore/FFMpeg/Arguments/PipeArgument.cs @@ -24,12 +24,15 @@ public abstract class PipeArgument public void Pre() { - if (Pipe != null) + lock (_pipeLock) { - throw new InvalidOperationException("Pipe already has been opened"); - } + if (Pipe != null) + { + throw new InvalidOperationException("Pipe already has been opened"); + } - Pipe = new NamedPipeServerStream(PipeName, _direction, 1, PipeTransmissionMode.Byte, PipeOptions.Asynchronous); + Pipe = new NamedPipeServerStream(PipeName, _direction, 1, PipeTransmissionMode.Byte, PipeOptions.Asynchronous); + } } public void Post()