Skip to content

Commit aad9fdc

Browse files
authored
Merge pull request #2700 from Flow-Launcher/jsonrpc-cleanup
add a close overload for jsonrpcpluginv2
2 parents b497c69 + b4a3347 commit aad9fdc

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

Flow.Launcher.Core/Plugin/JsonRPCPluginV2.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,20 @@ public virtual Task ReloadDataAsync()
139139
return Task.CompletedTask;
140140
}
141141

142-
public virtual ValueTask DisposeAsync()
142+
public virtual async ValueTask DisposeAsync()
143143
{
144-
RPC?.Dispose();
145-
ErrorStream?.Dispose();
146-
return ValueTask.CompletedTask;
144+
try
145+
{
146+
await RPC.InvokeAsync("close");
147+
}
148+
catch (RemoteMethodNotFoundException e)
149+
{
150+
}
151+
finally
152+
{
153+
RPC?.Dispose();
154+
ErrorStream?.Dispose();
155+
}
147156
}
148157
}
149158
}

0 commit comments

Comments
 (0)