From a35527e0e1b93886cfde829929e5e2c5270444a2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 18 Sep 2014 00:01:31 +0000 Subject: [PATCH] Fix crash when creating wxGraphicsBitmap from cairo_surface_t. Initialize m_buffer to avoid crashes when deleting it in Cairo-based wxGraphicsContext implementation for bitmaps created from the native ones. Don't leave the bitmap size uninitialized neither, this might not result in crashes, but is definitely wrong as well. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77718 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/graphicc.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/generic/graphicc.cpp b/src/generic/graphicc.cpp index 01b1db1b1d..7a380f23d0 100644 --- a/src/generic/graphicc.cpp +++ b/src/generic/graphicc.cpp @@ -1327,6 +1327,10 @@ wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, cairo_surfac { m_surface = bitmap; m_pattern = cairo_pattern_create_for_surface(m_surface); + + m_width = cairo_image_surface_get_width(m_surface); + m_height = cairo_image_surface_get_height(m_surface); + m_buffer = NULL; } wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitmap& bmp ) : wxGraphicsBitmapData( renderer )