From 96441d17f6a4c2751498b671a30da656061c6b80 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 18 Sep 2014 00:02:59 +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/branches/WX_3_0_BRANCH@77720 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 356c56ebf1..2d715e8ccf 100644 --- a/src/generic/graphicc.cpp +++ b/src/generic/graphicc.cpp @@ -1316,6 +1316,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 )