Skip to content

Commit

Permalink
* Prevent public static final objects from getting deallocated by …
Browse files Browse the repository at this point in the history
…`PointerScope` (issue bytedeco/javacv#1599)
  • Loading branch information
saudet committed Feb 21, 2021
1 parent 97cb0fb commit 7f05222
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 30 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Prevent `public static final` objects from getting deallocated by `PointerScope` ([issue bytedeco/javacv#1599](https://github.com/bytedeco/javacv/issues/1599))
* Fix compatibility of Leptonica with JavaFX by upgrading to libpng 1.6.37 ([pull #1007](https://github.com/bytedeco/javacpp-presets/pull/1007))
* Introduce `linux-arm64` build for CUDA, cuDNN, and NCCL ([issue #735](https://github.com/bytedeco/javacpp-presets/issues/735))
* Add new array constructors to `opencv_core.Mat` that copy data for convenience ([pull #1002](https://github.com/bytedeco/javacpp-presets/pull/1002))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,5 @@ public CvPoint put(byte shift, CvPoint2D64f o) {
}
}

public static final CvPoint ZERO = new CvPoint().x(0).y(0);
public static final CvPoint ZERO = new CvPoint().x(0).y(0).retainReference();
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@ public double magnitude() {
}

public static final CvScalar
ZERO = new CvScalar().val(0, 0.0).val(1, 0.0).val(2, 0.0).val(3, 0.0),
ONE = new CvScalar().val(0, 1.0).val(1, 1.0).val(2, 1.0).val(3, 1.0),
ONEHALF = new CvScalar().val(0, 0.5).val(1, 0.5).val(2, 0.5).val(3, 0.5),
ALPHA1 = new CvScalar().val(0, 0.0).val(1, 0.0).val(2, 0.0).val(3, 1.0),
ALPHA255= new CvScalar().val(0, 0.0).val(1, 0.0).val(2, 0.0).val(3, 255.0),
ZERO = new CvScalar().val(0, 0.0).val(1, 0.0).val(2, 0.0).val(3, 0.0).retainReference(),
ONE = new CvScalar().val(0, 1.0).val(1, 1.0).val(2, 1.0).val(3, 1.0).retainReference(),
ONEHALF = new CvScalar().val(0, 0.5).val(1, 0.5).val(2, 0.5).val(3, 0.5).retainReference(),
ALPHA1 = new CvScalar().val(0, 0.0).val(1, 0.0).val(2, 0.0).val(3, 1.0).retainReference(),
ALPHA255= new CvScalar().val(0, 0.0).val(1, 0.0).val(2, 0.0).val(3, 255.0).retainReference(),

WHITE = CV_RGB(255, 255, 255),
GRAY = CV_RGB(128, 128, 128),
BLACK = CV_RGB( 0, 0, 0),
RED = CV_RGB(255, 0, 0),
GREEN = CV_RGB( 0, 255, 0),
BLUE = CV_RGB( 0, 0, 255),
CYAN = CV_RGB( 0, 255, 255),
MAGENTA = CV_RGB(255, 0, 255),
YELLOW = CV_RGB(255, 255, 0);
WHITE = CV_RGB(255, 255, 255).retainReference(),
GRAY = CV_RGB(128, 128, 128).retainReference(),
BLACK = CV_RGB( 0, 0, 0).retainReference(),
RED = CV_RGB(255, 0, 0).retainReference(),
GREEN = CV_RGB( 0, 255, 0).retainReference(),
BLUE = CV_RGB( 0, 0, 255).retainReference(),
CYAN = CV_RGB( 0, 255, 255).retainReference(),
MAGENTA = CV_RGB(255, 0, 255).retainReference(),
YELLOW = CV_RGB(255, 255, 0).retainReference();
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ public abstract class AbstractCvSize extends IntPointer {
return s;
}
}
public static final CvSize ZERO = new CvSize().width(0).height(0);
public static final CvSize ZERO = new CvSize().width(0).height(0).retainReference();
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,19 @@ public double magnitude() {
}

public static final Scalar
ZERO = new Scalar(0.0, 0.0, 0.0, 0.0),
ONE = new Scalar(1.0, 1.0, 1.0, 1.0),
ONEHALF = new Scalar(0.5, 0.5, 0.5, 0.5),
ALPHA1 = new Scalar(0.0, 0.0, 0.0, 1.0),
ALPHA255= new Scalar(0.0, 0.0, 0.0, 255.0),
ZERO = new Scalar(0.0, 0.0, 0.0, 0.0).retainReference(),
ONE = new Scalar(1.0, 1.0, 1.0, 1.0).retainReference(),
ONEHALF = new Scalar(0.5, 0.5, 0.5, 0.5).retainReference(),
ALPHA1 = new Scalar(0.0, 0.0, 0.0, 1.0).retainReference(),
ALPHA255= new Scalar(0.0, 0.0, 0.0, 255.0).retainReference(),

WHITE = RGB(255, 255, 255),
GRAY = RGB(128, 128, 128),
BLACK = RGB( 0, 0, 0),
RED = RGB(255, 0, 0),
GREEN = RGB( 0, 255, 0),
BLUE = RGB( 0, 0, 255),
CYAN = RGB( 0, 255, 255),
MAGENTA = RGB(255, 0, 255),
YELLOW = RGB(255, 255, 0);
WHITE = RGB(255, 255, 255).retainReference(),
GRAY = RGB(128, 128, 128).retainReference(),
BLACK = RGB( 0, 0, 0).retainReference(),
RED = RGB(255, 0, 0).retainReference(),
GREEN = RGB( 0, 255, 0).retainReference(),
BLUE = RGB( 0, 0, 255).retainReference(),
CYAN = RGB( 0, 255, 255).retainReference(),
MAGENTA = RGB(255, 0, 255).retainReference(),
YELLOW = RGB(255, 255, 0).retainReference();
}

0 comments on commit 7f05222

Please sign in to comment.