Fix wxBitmap::GetRawData() in wxQt

This method used to return a dangling pointer to a temporary buffer,
which resulted in a crash when using it, e.g. in the unit test.

Fix this by keeping a QImage as a member in wxBitmapRefData, so that the
pointer to its data remain valid until UngetRawData() is called.

Also check that GetRawData() returns a non-null pointer in the test.

Closes https://github.com/wxWidgets/wxWidgets/pull/1067
This commit is contained in:
Graham Dawes
2018-12-12 09:03:10 +00:00
committed by Vadim Zeitlin
parent 013c6a6b6a
commit db15e99884
2 changed files with 16 additions and 10 deletions

View File

@@ -126,6 +126,7 @@ void BitmapTestCase::OverlappingBlit()
if ( m_bmp.GetDepth() == 32 )
{
wxAlphaPixelData npd( m_bmp );
CPPUNIT_ASSERT_MESSAGE( "Expected raw pixels to not be NULL", npd );
wxAlphaPixelData::Iterator it( npd );
ASSERT_EQUAL_RGB( it, 255, 0, 0 );