Hi,
For wx 2.94, when used
wxNativePixelData data(bmp);
It cause below assert error, It is safe to comment out this assert message at ../../src/osx/core/bitmap.cpp(380) ?
I didn't saw any difference at my application, if i just ignore this message.
../../src/osx/core/bitmap.cpp(380): assert "m_rawAccessCount == 0" failed in BeginRawAccess().
Collecting stack trace information, please wait...../../src/osx/core/bitmap.cpp(401): assert "m_rawAccessCount == 1" failed in EndRawAccess().
It work on window and linux.
wxNativePixelData assert on cocoa
Re: wxNativePixelData assert on cocoa
Ignoring asserts is usually not a good idea. But without seeing code it's impossible to tell what causes it.
Use the source, Luke!
Re: wxNativePixelData assert on cocoa
Thank for advices.
I check on wxwidgets source, only found m_rawAccessCount variable on osx/core/bitmaps.cpp
It assign m_rawAccessCount = 0 on Init();
Increase on BeginRawAccess() and decrease on EndRawAccess()
When declare wxNativePixelData xxx(bmp);
the flow go to BeginRowAccess.
May be that is a bug, i didn't see others place for assigning this variable.
For my temporary solution, i just comment it
I check on wxwidgets source, only found m_rawAccessCount variable on osx/core/bitmaps.cpp
It assign m_rawAccessCount = 0 on Init();
Increase on BeginRawAccess() and decrease on EndRawAccess()
When declare wxNativePixelData xxx(bmp);
the flow go to BeginRowAccess.
May be that is a bug, i didn't see others place for assigning this variable.
For my temporary solution, i just comment it
Code: Select all
void *wxBitmapRefData::BeginRawAccess()
{
wxCHECK_MSG( IsOk(), NULL, wxT("invalid bitmap") ) ;
wxASSERT( m_rawAccessCount == 0 ) ;
#ifndef __WXOSX_IPHONE__
wxASSERT_MSG( m_pictHandle == NULL && m_iconRef == NULL ,
wxT("Currently, modifing bitmaps that are used in controls already is not supported") ) ;
#endif
++m_rawAccessCount ;
// we must destroy an existing cached image, as
// the bitmap data may change now
if ( m_cgImageRef )
{
CGImageRelease( m_cgImageRef ) ;
m_cgImageRef = NULL ;
}
return m_memBuf.GetData() ;
}
void wxBitmapRefData::EndRawAccess()
{
wxCHECK_RET( IsOk() , wxT("invalid bitmap") ) ;
wxASSERT( m_rawAccessCount == 1 ) ;
--m_rawAccessCount ;
}
Re: wxNativePixelData assert on cocoa
Actually i meant your code. Somehow you manage to get the access counter out of sync.
Use the source, Luke!