[Bug] Unhandled Exception: "Cannot set visibility or call Show, ShowDialog ... after a Window has closed"
Emxm3 opened this issue · comments
Pippyyy commented
Describe the bug
Stopping a recording when the recorders window is not shown throws an unhandled exception
To Reproduce
Steps to reproduce the behavior:
- Go to "Options" > "Recorder" > [ X ] Enable selection panning
- Set a shortcut key to enable panning while recording.
- Move the mouse in a way that moves the window's location to a new location (this makes the window disappear until the mouse stops).
- As the window disappears, quickly press F8 (stops recording)
- An error will be thrown. recording is fine and no data is lost, but is a bit of an annoyance
Expected behavior
Recording should stop and application flow should continue as normal with no unexpected pop-ups
Desktop (please complete the following information):
- OS: Windows 11
- Version 2.37 - 2.39
Additional context
System.InvalidOperationException: Cannot set Visibility or call Show, ShowDialog, or WindowInteropHelper.EnsureHandle after a Window has closed.
at System.Windows.Window.VerifyCanShow()
at System.Windows.Window.Show()
at ScreenToGif.Windows.Other.RegionSelection.Select(Nullable`1 mode, Rect region, Monitor monitor) in C:\Users\nicke\source\repos\ScreenToGif\ScreenToGif\Windows\Other\RegionSelection.xaml.cs:line 197
at ScreenToGif.Windows.NewRecorder.DisplaySelection(Nullable`1 mode, Monitor display) in C:\Users\nicke\source\repos\ScreenToGif\ScreenToGif\Windows\NewRecorder.xaml.cs:line 1483
at ScreenToGif.Windows.NewRecorder.ShowBorderTimer_Tick(Object sender, EventArgs e) in C:\Users\nicke\source\repos\ScreenToGif\ScreenToGif\Windows\NewRecorder.xaml.cs:line 717
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam)