X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/30386aeb867e0b6311450a87c056c42301765a65..0b822969a677939811d9fb966177031fb5fc625b:/include/wx/buffer.h?ds=inline diff --git a/include/wx/buffer.h b/include/wx/buffer.h index bfaba4e58d..346ef113f9 100644 --- a/include/wx/buffer.h +++ b/include/wx/buffer.h @@ -15,7 +15,9 @@ #include "wx/chartype.h" #include "wx/wxcrtbase.h" +#ifndef __WXPALMOS5__ #include // malloc() and free() +#endif // ! __WXPALMOS5__ class WXDLLIMPEXP_FWD_BASE wxCStrData; @@ -105,9 +107,12 @@ public: wxCharTypeBuffer& operator=(const wxCharTypeBuffer& src) { - if ( m_owned ) - free(m_str); - CopyFrom(src); + if (&src != this) + { + if ( m_owned ) + free(m_str); + CopyFrom(src); + } return *this; } @@ -228,9 +233,9 @@ typedef wxWritableCharTypeBuffer wxWritableWCharBuffer; // type of the value returned by wxString::utf8_str() #if wxUSE_UNICODE_UTF8 - #define wxUTF8Buf wxCharBuffer -#else #define wxUTF8Buf char * +#else + #define wxUTF8Buf wxCharBuffer #endif // ---------------------------------------------------------------------------- @@ -317,9 +322,12 @@ public: wxMemoryBuffer& operator=(const wxMemoryBuffer& src) { - m_bufdata->DecRef(); - m_bufdata = src.m_bufdata; - m_bufdata->IncRef(); + if (&src != this) + { + m_bufdata->DecRef(); + m_bufdata = src.m_bufdata; + m_bufdata->IncRef(); + } return *this; }