Commit cfb22b15 authored by nanahira's avatar nanahira

safe dispose ocgcore

parent 8caf4b7d
Pipeline #43203 failed with stages
in 77 minutes and 56 seconds
...@@ -185,7 +185,7 @@ export class Room { ...@@ -185,7 +185,7 @@ export class Room {
]); ]);
} }
private finalizors: RoomFinalizor[] = [() => this.ocgcore?.dispose()]; private finalizors: RoomFinalizor[] = [() => this.disposeOcgcore()];
addFinalizor(finalizor: RoomFinalizor, atEnd = false) { addFinalizor(finalizor: RoomFinalizor, atEnd = false) {
if (atEnd) { if (atEnd) {
...@@ -297,7 +297,7 @@ export class Room { ...@@ -297,7 +297,7 @@ export class Room {
private sendPostWatchMessages(client: Client) { private sendPostWatchMessages(client: Client) {
client.send(new YGOProStocDuelStart()); client.send(new YGOProStocDuelStart());
// 在 SelectHand / SelectTp 阶段发送 DeckCount // 在 SelectHand / SelectTp 阶段发送 DeckCount
// Siding 阶段不发 DeckCount // Siding 阶段不发 DeckCount
if ( if (
...@@ -416,9 +416,16 @@ export class Room { ...@@ -416,9 +416,16 @@ export class Room {
return this.duelRecords[this.duelRecords.length - 1]; return this.duelRecords[this.duelRecords.length - 1];
} }
private disposeOcgcore() {
try {
this.ocgcore?.dispose().catch();
this.ocgcore = undefined;
} catch {}
}
async win(winMsg: Partial<YGOProMsgWin>, forceWinMatch = false) { async win(winMsg: Partial<YGOProMsgWin>, forceWinMatch = false) {
this.resetResponseState(); this.resetResponseState();
await this.ocgcore?.dispose(); this.disposeOcgcore();
this.ocgcore = undefined; this.ocgcore = undefined;
if (this.duelStage === DuelStage.Siding) { if (this.duelStage === DuelStage.Siding) {
this.playingPlayers this.playingPlayers
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment