]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/image.cpp
fix warnings about parameters shadowing member variables
[wxWidgets.git] / src / common / image.cpp
index 6df19503b26ffa72badadeb68bd058ad8d3cead8..92bbdde513e35aa9b79f661b82216eaf62e860cc 100644 (file)
@@ -1665,7 +1665,9 @@ void wxImage::SetAlpha( unsigned char *alpha, bool static_data )
         alpha = (unsigned char *)malloc(M_IMGDATA->m_width*M_IMGDATA->m_height);
     }
 
-    free(M_IMGDATA->m_alpha);
+    if( !M_IMGDATA->m_staticAlpha )
+        free(M_IMGDATA->m_alpha);
+
     M_IMGDATA->m_alpha = alpha;
     M_IMGDATA->m_staticAlpha = static_data;
 }
@@ -1898,8 +1900,11 @@ bool wxImage::ConvertAlphaToMask(unsigned char threshold)
         }
     }
 
-    free(M_IMGDATA->m_alpha);
+    if( !M_IMGDATA->m_staticAlpha )
+        free(M_IMGDATA->m_alpha);
+
     M_IMGDATA->m_alpha = NULL;
+    M_IMGDATA->m_staticAlpha = false;
 
     return true;
 }