Rémy,

On 6/14/24 5:16 PM, r...@apache.org wrote:
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
      new 075694ab2d Port tweak to avoid counting down if not initialized
075694ab2d is described below

commit 075694ab2d5a979eefca5bba273c72c5d785ce68
Author: remm <r...@apache.org>
AuthorDate: Fri Jun 14 23:15:53 2024 +0200

     Port tweak to avoid counting down if not initialized
---
  java/org/apache/tomcat/util/net/openssl/panama/OpenSSLLibrary.java | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLLibrary.java 
b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLLibrary.java
index f4501c7fa6..262e97b671 100644
--- a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLLibrary.java
+++ b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLLibrary.java
@@ -334,11 +334,11 @@ public class OpenSSLLibrary {
public static void destroy() {
          synchronized (lock) {
-            if (--referenceCount != 0) {
-                // Still being used (note test is performed after reference 
count is decremented)
+            if (!OpenSSLStatus.isInitialized()) {
                  return;
              }
-            if (!OpenSSLStatus.isInitialized()) {
+            if (--referenceCount != 0) {
+                // Still being used (note test is performed after reference 
count is decremented)
                  return;
              }

I always like to use <= 0 for these kinds of things "just in case" the value skips 0 when you aren't paying attention. You don't want this value to be able to go very far into the negative and possibly weird things can happen.

-chris

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to