1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 10:23:03 +08:00

Fix mouse cursor potentially disappearing for good if screenshot capture fails

This commit is contained in:
Dean Herbert 2023-06-01 15:50:10 +09:00
parent bbc5b86077
commit 0a7d5a51d4

View File

@ -86,6 +86,8 @@ namespace osu.Game.Graphics
{
Interlocked.Increment(ref screenShotTasks);
try
{
if (!captureMenuCursor.Value)
{
cursorVisibility.Value = false;
@ -113,9 +115,6 @@ namespace osu.Game.Graphics
using (var image = await host.TakeScreenshotAsync().ConfigureAwait(false))
{
if (Interlocked.Decrement(ref screenShotTasks) == 0 && cursorVisibility.Value == false)
cursorVisibility.Value = true;
host.GetClipboard()?.SetImage(image);
(string filename, var stream) = getWritableStream();
@ -151,6 +150,12 @@ namespace osu.Game.Graphics
}
});
}
}
finally
{
if (Interlocked.Decrement(ref screenShotTasks) == 0)
cursorVisibility.Value = true;
}
});
private static readonly object filename_reservation_lock = new object();