@@ -124,15 +124,15 @@ public CrtResource() {
124124 * @param resource The resource to add a reference to
125125 */
126126 public void addReferenceTo (CrtResource resource ) {
127- int refCount = resource . addRef ();
127+ int remainingRefs = refCount . incrementAndGet ();
128128 synchronized (this ) {
129129 referencedResources .add (resource );
130130 }
131131
132132 if (debugNativeObjects ) {
133133 Log .log (ResourceLogLevel , Log .LogSubject .JavaCrtResource ,
134134 String .format ("Instance of class %s(%d) is adding a reference to instance of class %s(%d) increasing its refcount to %d" ,
135- this .getClass ().getCanonicalName (), id , resource .getClass ().getCanonicalName (), resource .id , refCount ));
135+ this .getClass ().getCanonicalName (), id , resource .getClass ().getCanonicalName (), resource .id , remainingRefs ));
136136 }
137137 }
138138
@@ -243,20 +243,20 @@ public long getNativeHandle() {
243243 /**
244244 * Increments the reference count to this resource.
245245 */
246- public int addRef () {
247- return refCount .incrementAndGet ();
246+ public void addRef () {
247+ refCount .incrementAndGet ();
248248 }
249249
250250 /**
251251 * Increments the reference count to this resource with a description.
252252 * @param desc Descrption string of why the reference is being incremented.
253253 */
254254 public void addRefDescribe (String desc ) {
255- int refCount = addRef ();
255+ int remainingRefs = refCount . incrementAndGet ();
256256 if (debugNativeObjects ) {
257257 Log .log (ResourceLogLevel , Log .LogSubject .JavaCrtResource ,
258258 String .format ("Instance of class %s(%d) is adding a reference for: (%s). RefCount is now %d" ,
259- this .getClass ().getCanonicalName (), id , desc , refCount ));
259+ this .getClass ().getCanonicalName (), id , desc , remainingRefs ));
260260 }
261261 }
262262
0 commit comments