From b956691cdd7e2414175372e12da1d6abfacb85fa Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Tue, 31 Jan 2023 21:43:09 -0500 Subject: [PATCH] WeakReferenceable: Allow reference counts of either 0 or 1 during destruction. Same rationale as for BReferenceable. Fixes a KDL seen on boot by at least one user following prior changes. --- src/kits/shared/WeakReferenceable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kits/shared/WeakReferenceable.cpp b/src/kits/shared/WeakReferenceable.cpp index 9387aad292..b9ca0cd6c2 100644 --- a/src/kits/shared/WeakReferenceable.cpp +++ b/src/kits/shared/WeakReferenceable.cpp @@ -79,7 +79,7 @@ BWeakReferenceable::BWeakReferenceable() BWeakReferenceable::~BWeakReferenceable() { - if (fPointer->UseCount() > 0) { + if (fPointer->UseCount() != 0 && fPointer->UseCount() != 1) { char message[256]; snprintf(message, sizeof(message), "deleting referenceable object %p with " "reference count (%" B_PRId32 ")", this, fPointer->UseCount());