From f341a3c51f1e4c4daf9ad9e37519414625308569 Mon Sep 17 00:00:00 2001 From: "gagan%netscape.com" Date: Thu, 24 Feb 2000 05:34:28 +0000 Subject: [PATCH] Avoid calling Copy from operator= if we are just resetting the nsXPIDLString. So now it is safe to reset an nsXPIDLCString or nsXPIDLString by setting it to null. r=waterson,a=jevering git-svn-id: svn://10.0.0.236/trunk@61590 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/string/obsolete/nsXPIDLString.cpp | 3 ++- mozilla/xpcom/ds/nsXPIDLString.cpp | 3 ++- mozilla/xpcom/string/obsolete/nsXPIDLString.cpp | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mozilla/string/obsolete/nsXPIDLString.cpp b/mozilla/string/obsolete/nsXPIDLString.cpp index 0fd5778c39b..c18024ae2cc 100644 --- a/mozilla/string/obsolete/nsXPIDLString.cpp +++ b/mozilla/string/obsolete/nsXPIDLString.cpp @@ -128,7 +128,8 @@ nsXPIDLCString& nsXPIDLCString::operator =(const char* aCString) if (mBufOwner && mBuf) XPIDL_FREE(mBuf); - mBuf = Copy(aCString); + if (aCString) + mBuf = Copy(aCString); mBufOwner = PR_TRUE; return *this; diff --git a/mozilla/xpcom/ds/nsXPIDLString.cpp b/mozilla/xpcom/ds/nsXPIDLString.cpp index 0fd5778c39b..c18024ae2cc 100644 --- a/mozilla/xpcom/ds/nsXPIDLString.cpp +++ b/mozilla/xpcom/ds/nsXPIDLString.cpp @@ -128,7 +128,8 @@ nsXPIDLCString& nsXPIDLCString::operator =(const char* aCString) if (mBufOwner && mBuf) XPIDL_FREE(mBuf); - mBuf = Copy(aCString); + if (aCString) + mBuf = Copy(aCString); mBufOwner = PR_TRUE; return *this; diff --git a/mozilla/xpcom/string/obsolete/nsXPIDLString.cpp b/mozilla/xpcom/string/obsolete/nsXPIDLString.cpp index 0fd5778c39b..c18024ae2cc 100644 --- a/mozilla/xpcom/string/obsolete/nsXPIDLString.cpp +++ b/mozilla/xpcom/string/obsolete/nsXPIDLString.cpp @@ -128,7 +128,8 @@ nsXPIDLCString& nsXPIDLCString::operator =(const char* aCString) if (mBufOwner && mBuf) XPIDL_FREE(mBuf); - mBuf = Copy(aCString); + if (aCString) + mBuf = Copy(aCString); mBufOwner = PR_TRUE; return *this;