Skip to content

Commit 0c34623

Browse files
committed
Move deallocator to the right place
1 parent 59711d0 commit 0c34623

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/main/java/software/coley/llzip/util/BufferData.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ public void close() {
103103
if (cleaned)
104104
return;
105105
cleaned = true;
106-
}
107-
ByteBuffer buffer = this.buffer;
108-
if (buffer.isDirect()) {
109-
CleanerUtil.invokeCleaner(buffer);
106+
ByteBuffer buffer = this.buffer;
107+
if (buffer.isDirect()) {
108+
CleanerUtil.invokeCleaner(buffer);
109+
}
110110
}
111111
}
112112
}

src/main/java/software/coley/llzip/util/UnsafeMappedFile.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,11 @@ public void close() {
116116
if (cleaned)
117117
return;
118118
cleaned = true;
119+
Runnable deallocator = this.deallocator;
120+
if (deallocator != null)
121+
deallocator.run();
119122
}
120123
}
121-
Runnable deallocator = this.deallocator;
122-
if (deallocator != null)
123-
deallocator.run();
124124
}
125125

126126
private void ensureOpen() {

0 commit comments

Comments
 (0)