Skip to content

Fix massive memory leak in previews (#679) #680

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Oct 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class BlobsSocketPreviewView extends SocketPreviewView<BlobsReport> {
private final ImageView imageView = new ImageView();
private final Label infoLabel = new Label();
private final Mat tmp = new Mat();
private final Point point = new Point();
private final GripPlatform platform;
@SuppressWarnings("PMD.ImmutableField")
@SuppressFBWarnings(value = "IS2_INCONSISTENT_SYNC",
Expand Down Expand Up @@ -91,7 +92,8 @@ private void convertImage() {
if (!blobsReport.getBlobs().isEmpty()) {
// For each line in the report, draw a line along with the starting and ending points
for (BlobsReport.Blob blob : blobsReport.getBlobs()) {
final Point point = new Point((int) blob.x, (int) blob.y);
point.x((int) blob.x);
point.y((int) blob.y);
circle(tmp, point, (int) (blob.size / 2), Scalar.WHITE, 2, LINE_8, 0);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public class LinesSocketPreviewView extends SocketPreviewView<LinesReport> {
private final ImageView imageView = new ImageView();
private final Label infoLabel = new Label();
private final Mat tmp = new Mat();
private final Point startPoint = new Point();
private final Point endPoint = new Point();
private final GripPlatform platform;
@SuppressWarnings("PMD.ImmutableField")
@SuppressFBWarnings(value = "IS2_INCONSISTENT_SYNC",
Expand Down Expand Up @@ -99,8 +101,10 @@ private void convertImage() {

// For each line in the report, draw a line along with the starting and ending points
for (LinesReport.Line line : lines) {
final Point startPoint = new Point((int) line.x1, (int) line.y1);
final Point endPoint = new Point((int) line.x2, (int) line.y2);
startPoint.x((int) line.x1);
startPoint.y((int) line.y1);
endPoint.x((int) line.x2);
endPoint.y((int) line.y2);
line(input, startPoint, endPoint, Scalar.WHITE, 2, LINE_8, 0);
circle(input, startPoint, 2, Scalar.WHITE, 2, LINE_8, 0);
circle(input, endPoint, 2, Scalar.WHITE, 2, LINE_8, 0);
Expand Down