mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Temporary fix for sharing violation
Sharing violation may occur when reindexing after deleting user added source, causing some uwp programs can't be indexed. Don't actually know why it happens. Try to fix it.
This commit is contained in:
parent
cbcae41d0a
commit
e72810ca2c
1 changed files with 4 additions and 3 deletions
|
|
@ -60,8 +60,8 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
InitPackageVersion(namespaces);
|
||||
|
||||
const uint noAttribute = 0x80;
|
||||
const Stgm exclusiveRead = Stgm.Read | Stgm.ShareExclusive;
|
||||
var hResult = SHCreateStreamOnFileEx(path, exclusiveRead, noAttribute, false, null, out IStream stream);
|
||||
const Stgm nonExclusiveRead = Stgm.Read | Stgm.ShareDenyNone;
|
||||
var hResult = SHCreateStreamOnFileEx(path, nonExclusiveRead, noAttribute, false, null, out IStream stream);
|
||||
|
||||
if (hResult == Hresult.Ok)
|
||||
{
|
||||
|
|
@ -85,7 +85,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
Apps = new List<Application>().ToArray();
|
||||
}
|
||||
|
||||
if (Marshal.ReleaseComObject(stream) > 0)
|
||||
if (stream != null && Marshal.ReleaseComObject(stream) > 0)
|
||||
{
|
||||
Log.Error("Flow.Launcher.Plugin.Program.Programs.UWP", "AppxManifest.xml was leaked");
|
||||
}
|
||||
|
|
@ -784,6 +784,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
{
|
||||
Read = 0x0,
|
||||
ShareExclusive = 0x10,
|
||||
ShareDenyNone = 0x40
|
||||
}
|
||||
|
||||
private enum Hresult : uint
|
||||
|
|
|
|||
Loading…
Reference in a new issue