diff --git a/headers/private/shared/Variant.h b/headers/private/shared/Variant.h index 0a1fb80315..bc497a30e0 100644 --- a/headers/private/shared/Variant.h +++ b/headers/private/shared/Variant.h @@ -86,6 +86,7 @@ public: double ToDouble() const; void* ToPointer() const; const char* ToString() const; + BReferenceable* ToReferenceable() const; void SwapEndianess(); // has effect only on scalar types (pointer diff --git a/src/kits/shared/Variant.cpp b/src/kits/shared/Variant.cpp index 980de5b6d7..1d63447367 100644 --- a/src/kits/shared/Variant.cpp +++ b/src/kits/shared/Variant.cpp @@ -336,13 +336,21 @@ BVariant::_SetTo(const BVariant& other) } } else if ((other.fFlags & B_VARIANT_REFERENCEABLE_DATA) != 0) { if (other.fReferenceable != NULL) - fReferenceable->AcquireReference(); + other.fReferenceable->AcquireReference(); } memcpy(this, &other, sizeof(BVariant)); } +BReferenceable* +BVariant::ToReferenceable() const +{ + return (fFlags & B_VARIANT_REFERENCEABLE_DATA) != 0 + ? fReferenceable : NULL; +} + + void BVariant::SwapEndianess() {