]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/buffer.h
[ 1945434 ] Changing method wxComboCtrlBase::DrawButton to virtual one
[wxWidgets.git] / include / wx / buffer.h
index 81a445afe57bbc98a9c03039efdc37075691eeeb..346ef113f9b6bb78d4f9f0e653d765e54810c773 100644 (file)
@@ -15,7 +15,9 @@
 #include "wx/chartype.h"
 #include "wx/wxcrtbase.h"
 
+#ifndef __WXPALMOS5__
 #include <stdlib.h>             // 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;
     }
 
@@ -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;
     }