From e3c245c226c51de26bfa222561dbba51e9f68991 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 3 Jan 2017 02:50:26 +0100 Subject: [PATCH] Select the bitmap out of wxDC before using it in the unit test The unit test added in 607b800444193d618158d37a69f08d81ae2de986 had a bug as it tried to use the bitmap directly while it was still selected into a wxMemoryDC, which wasn't guaranteed to work and resulted in an assert. Fix this by destroying wxMemoryDC earlier. See #17666. --- tests/graphics/bitmap.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/graphics/bitmap.cpp b/tests/graphics/bitmap.cpp index 80f10170bd..365fa3f7b4 100644 --- a/tests/graphics/bitmap.cpp +++ b/tests/graphics/bitmap.cpp @@ -93,7 +93,7 @@ void BitmapTestCase::OverlappingBlit() m_bmp.SetMask( NULL ); // Clear to white. - + { wxMemoryDC dc(m_bmp); dc.SetBackground( *wxWHITE ); dc.Clear(); @@ -106,6 +106,7 @@ void BitmapTestCase::OverlappingBlit() // Scroll down one line. dc.Blit( 0, 1, 10, 9, &dc, 0, 0 ); + } // Select the bitmap out of the memory DC before using it directly. // Now, lines 0 and 1 should be red, lines 2++ should still be white.