Skip to content
Prev Previous commit
Next Next commit
Prevent "already disposed" errors when trying to kill disposed proxies
  • Loading branch information
code-asher committed Apr 9, 2019
commit 827dae60b7d62c64bf5efc88d195d996e714d03f
7 changes: 4 additions & 3 deletions packages/protocol/src/browser/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,10 @@ export class Client {
* Make a remote call for a proxy's method using proto.
*/
private remoteCall(proxyId: number | Module, method: string, args: any[]): Promise<any> {
if (this.disconnected && typeof proxyId === "number") {
// Can assume killing or closing works because a disconnected proxy
// is disposed on the server's side.
if (typeof proxyId === "number" && (this.disconnected || !this.proxies.has(proxyId))) {
// Can assume killing or closing works because a disconnected proxy is
// disposed on the server's side, and a non-existent proxy has already
// been disposed.
switch (method) {
case "close":
case "kill":
Expand Down