diff --git a/string/public/nsBufferHandle.h b/string/public/nsBufferHandle.h index c76f24196ed..91e4eec421e 100755 --- a/string/public/nsBufferHandle.h +++ b/string/public/nsBufferHandle.h @@ -94,14 +94,16 @@ class nsSharedBufferHandle void AcquireReference() const { - set_refcount( get_refcount()+1 ); + nsSharedBufferHandle* mutable_this = NS_CONST_CAST(nsSharedBufferHandle*, this); + mutable_this->set_refcount( get_refcount()+1 ); } void ReleaseReference() const { - if ( !set_refcount( get_refcount()-1 ) ) - delete this; + nsSharedBufferHandle* mutable_this = NS_CONST_CAST(nsSharedBufferHandle*, this); + if ( !mutable_this->set_refcount( get_refcount()-1 ) ) + delete mutable_this; } PRBool diff --git a/xpcom/ds/nsBufferHandle.h b/xpcom/ds/nsBufferHandle.h index c76f24196ed..91e4eec421e 100755 --- a/xpcom/ds/nsBufferHandle.h +++ b/xpcom/ds/nsBufferHandle.h @@ -94,14 +94,16 @@ class nsSharedBufferHandle void AcquireReference() const { - set_refcount( get_refcount()+1 ); + nsSharedBufferHandle* mutable_this = NS_CONST_CAST(nsSharedBufferHandle*, this); + mutable_this->set_refcount( get_refcount()+1 ); } void ReleaseReference() const { - if ( !set_refcount( get_refcount()-1 ) ) - delete this; + nsSharedBufferHandle* mutable_this = NS_CONST_CAST(nsSharedBufferHandle*, this); + if ( !mutable_this->set_refcount( get_refcount()-1 ) ) + delete mutable_this; } PRBool diff --git a/xpcom/string/public/nsBufferHandle.h b/xpcom/string/public/nsBufferHandle.h index c76f24196ed..91e4eec421e 100755 --- a/xpcom/string/public/nsBufferHandle.h +++ b/xpcom/string/public/nsBufferHandle.h @@ -94,14 +94,16 @@ class nsSharedBufferHandle void AcquireReference() const { - set_refcount( get_refcount()+1 ); + nsSharedBufferHandle* mutable_this = NS_CONST_CAST(nsSharedBufferHandle*, this); + mutable_this->set_refcount( get_refcount()+1 ); } void ReleaseReference() const { - if ( !set_refcount( get_refcount()-1 ) ) - delete this; + nsSharedBufferHandle* mutable_this = NS_CONST_CAST(nsSharedBufferHandle*, this); + if ( !mutable_this->set_refcount( get_refcount()-1 ) ) + delete mutable_this; } PRBool