fix possible race condition

This commit is contained in:
stax76
2022-07-02 15:10:22 +02:00
parent fb294c441d
commit 40565e8b3d

View File

@@ -1276,12 +1276,17 @@ namespace mpvnet
} }
} }
static object LoadFolderLockObject = new object();
public void LoadFolder() public void LoadFolder()
{ {
if (!App.AutoLoadFolder || Control.ModifierKeys.HasFlag(Keys.Shift)) if (!App.AutoLoadFolder || Control.ModifierKeys.HasFlag(Keys.Shift))
return; return;
Thread.Sleep(1000); Thread.Sleep(1000);
lock (LoadFolderLockObject)
{
string path = GetPropertyString("path"); string path = GetPropertyString("path");
if (!File.Exists(path) || GetPropertyInt("playlist-count") != 1) if (!File.Exists(path) || GetPropertyInt("playlist-count") != 1)
@@ -1312,6 +1317,7 @@ namespace mpvnet
if (index > 0) if (index > 0)
CommandV("playlist-move", "0", (index + 1).ToString()); CommandV("playlist-move", "0", (index + 1).ToString());
} }
}
bool WasAviSynthLoaded; bool WasAviSynthLoaded;