Fixing crash in NS_MsgStripRE() due to multiply-linked strings. b=189591, sr=dbaron, r=me

git-svn-id: svn://10.0.0.236/trunk@136768 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dougt%netscape.com
2003-01-22 00:21:48 +00:00
parent ecedb3f82e
commit ff549712f7
6 changed files with 16 additions and 24 deletions

View File

@@ -180,11 +180,6 @@ struct nsStringAllocatorTraits<PRUnichar>
// end of string allocator stuff that needs to move
/**
*
* @status FROZEN
*/
template <class CharT>
class nsSharedBufferHandle
: public nsBufferHandle<CharT>
@@ -192,7 +187,6 @@ class nsSharedBufferHandle
public:
typedef PRUint32 size_type;
protected:
enum
{
kIsImmutable = 0x01000000, // if this is set, the buffer cannot be modified even if its refcount is 1

View File

@@ -188,9 +188,9 @@ class NS_COM nsXPIDLString
// overridden to make getter_Copies mechanism work
virtual const char_type* get() const
{
return (mBuffer.get() != GetSharedEmptyBufferHandle())
? mBuffer->DataStart()
: 0;
return (mBuffer->GetImplementationFlags() & shared_buffer_handle_type::kIsNULL)
? 0
: mBuffer->DataStart();
}
// deprecated, to be eliminated
@@ -300,9 +300,9 @@ class NS_COM nsXPIDLCString
// overridden to make getter_Copies mechanism work
virtual const char_type* get() const
{
return (mBuffer.get() != GetSharedEmptyBufferHandle())
? mBuffer->DataStart()
: 0;
return (mBuffer->GetImplementationFlags() & shared_buffer_handle_type::kIsNULL)
? 0
: mBuffer->DataStart();
}
// deprecated, to be eliminated

View File

@@ -156,6 +156,7 @@ nsXPIDLString::GetSharedEmptyBufferHandle()
// race to set the refcount, in
// which case we'll pull the
// same trick in |Destroy|.
sBufferHandle->SetImplementationFlags(sBufferHandle->GetImplementationFlags() & shared_buffer_handle_type::kIsNULL);
}
return sBufferHandle;
}
@@ -238,6 +239,7 @@ nsXPIDLCString::GetSharedEmptyBufferHandle()
// race to set the refcount, in
// which case we'll pull the
// same trick in |Destroy|.
sBufferHandle->SetImplementationFlags(sBufferHandle->GetImplementationFlags() & shared_buffer_handle_type::kIsNULL);
}
return sBufferHandle;
}