Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Fixed an issue where the right-click menu would sometimes freeze the app #12686

Merged
merged 2 commits into from
Jun 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions src/Files.App/Shell/ShellNewMenuHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,28 @@ public static async Task<ShellNewEntry> GetNewContextMenuEntryForType(string ext

private static async Task<ShellNewEntry> GetShellNewRegistryEntries(RegistryKey current, RegistryKey root)
{
foreach (var keyName in current.GetSubKeyNames())
try
{
using var key = current.OpenSubKeySafe(keyName);

if (key is null)
continue;

if (keyName == "ShellNew")
return await ParseShellNewRegistryEntry(key, root);
else
foreach (var keyName in current.GetSubKeyNames())
{
var ret = await GetShellNewRegistryEntries(key, root);
if (ret is not null)
return ret;
using var key = current.OpenSubKeySafe(keyName);

if (key is null)
continue;

if (keyName == "ShellNew")
return await ParseShellNewRegistryEntry(key, root);
else
{
var ret = await GetShellNewRegistryEntries(key, root);
if (ret is not null)
return ret;
}
}
}
catch {
// Ignore exceptions when the registry is inaccessible to avoid freezes
}

return null;
}
Expand Down