From d2502f1471fc1970cf5f997b86f71bf916d23868 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 2 Apr 2005 21:19:54 +0000 Subject: [PATCH] use separate is-static flag for alpha channel and main data git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33282 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/image.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/common/image.cpp b/src/common/image.cpp index c8d8a28028..7767fedb90 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -68,8 +68,13 @@ public: unsigned char *m_alpha; bool m_ok; + + // if true, m_data is pointer to static data and shouldn't be freed bool m_static; + // same as m_static but for m_alpha + bool m_staticAlpha; + #if wxUSE_PALETTE wxPalette m_palette; #endif // wxUSE_PALETTE @@ -93,16 +98,16 @@ wxImageRefData::wxImageRefData() m_hasMask = false; m_ok = false; - m_static = false; + m_static = + m_staticAlpha = false; } wxImageRefData::~wxImageRefData() { - if (!m_static) - { + if ( !m_static ) free( m_data ); + if ( !m_staticAlpha ) free( m_alpha ); - } } wxList wxImage::sm_handlers; @@ -997,7 +1002,7 @@ void wxImage::SetAlpha( unsigned char *alpha, bool static_data ) free(M_IMGDATA->m_alpha); M_IMGDATA->m_alpha = alpha; - M_IMGDATA->m_static = static_data; + M_IMGDATA->m_staticAlpha = static_data; } unsigned char *wxImage::GetAlpha() const -- 2.45.2