fix severe termination bug

This commit is contained in:
stax76
2022-10-02 15:40:53 +02:00
parent 22960af78b
commit 337bee9f28
9 changed files with 21 additions and 157 deletions

View File

@@ -222,6 +222,12 @@ namespace mpvnet
InvokeAsync(InitializedAsync);
}
public void Destroy()
{
mpv_destroy(Handle);
mpv_destroy(NamedHandle);
}
void ApplyShowMenuFix()
{
if (App.Settings.ShowMenuFixApplied)
@@ -1732,6 +1738,9 @@ namespace mpvnet
if (title.TrimEx() == format)
title = null;
if (!string.IsNullOrEmpty(title))
title = title.Trim(" _-".ToCharArray());
}
track = new MediaTrack();
@@ -1815,6 +1824,9 @@ namespace mpvnet
if (title.ContainsEx("[]"))
title = title.Replace("[]", "");
if (!string.IsNullOrEmpty(title))
title = title.Trim(" _-".ToCharArray());
}
track = new MediaTrack();

View File

@@ -14,6 +14,9 @@ public class libmpv
[DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern mpv_error mpv_initialize(IntPtr mpvHandle);
[DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void mpv_destroy(IntPtr mpvHandle);
[DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern mpv_error mpv_command(IntPtr mpvHandle, IntPtr strings);

View File

@@ -1235,6 +1235,8 @@ namespace mpvnet
if (!Core.ShutdownAutoResetEvent.WaitOne(10000))
Msg.ShowError("Shutdown thread failed to complete within 10 seconds.");
Core.Destroy();
}
protected override void OnMouseDown(MouseEventArgs e)