Skip to content

Commit 7e19ad6

Browse files
committed
Remove from the cache when image memory release
1 parent b112e3e commit 7e19ad6

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

weasis-core/src/main/java/org/weasis/core/api/media/data/Thumbnail.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ protected Boolean doInBackground() {
264264
}
265265

266266
private void loadThumbnail(
267-
final MediaElement media, final boolean keepMediaCache, final OpManager opManager) {
267+
final MediaElement media, boolean keepMediaCache, OpManager opManager) {
268268
try {
269269
File file = thumbnailPath;
270270
boolean noPath = file == null || !file.canRead();
@@ -310,6 +310,7 @@ private void loadThumbnail(
310310
if (thumb == null || thumb.width() <= 0) {
311311
readable = false;
312312
ImageConversion.releasePlanarImage(thumb);
313+
keepMediaCache = false;
313314
} else {
314315
mCache.put(this, thumb);
315316
}

weasis-dicom/weasis-dicom-codec/src/main/java/org/weasis/dicom/codec/BasicContourLoader.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,13 @@ public Set<SegContour> getLazyContours() {
5555

5656
private SegContour buildContour() {
5757
PlanarImage binary = binaryMask.getImage();
58+
if (binary == null || binary.width() <= 0) {
59+
return null;
60+
}
5861
List<Segment> segmentList = Region.buildSegmentList(binary);
5962
int pixelCount = Core.countNonZero(binary.toMat());
6063
ImageConversion.releasePlanarImage(binary);
64+
binaryMask.removeImageFromCache();
6165

6266
SegContour contour = new SegContour(String.valueOf(id), segmentList, pixelCount);
6367
region.addPixels(contour);

0 commit comments

Comments
 (0)