Skip to content

Commit

Permalink
fix: free object after calling anyway
Browse files Browse the repository at this point in the history
  • Loading branch information
Myriad-Dreamin committed Jan 3, 2024
1 parent 196eeea commit 060c3c4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/typst.ts/src/compiler.mts
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,11 @@ class TypstCompilerDriver {

async withIncrementalServer<T>(f: (s: IncrementalServer) => Promise<T>): Promise<T> {
const srv = new IncrementalServer(this.compiler.create_incr_server());
const res = f(srv);
srv[kObject].free();
return res;
try {
return await f(srv);
} finally {
srv[kObject].free();
}
}

async getAst(mainFilePath: string): Promise<string> {
Expand Down

0 comments on commit 060c3c4

Please sign in to comment.