From f5b4d707b82d95f50071354b3722d8206127183e Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Tue, 25 Sep 2018 19:45:42 +0200 Subject: [PATCH] Do not use variable-length array in WXQT wxRegion This is not supported by MSVC compiler. --- src/qt/region.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/qt/region.cpp b/src/qt/region.cpp index ad6551d3ea..45936ab577 100644 --- a/src/qt/region.cpp +++ b/src/qt/region.cpp @@ -10,6 +10,7 @@ #include "wx/region.h" #include "wx/bitmap.h" +#include "wx/scopedarray.h" #include "wx/qt/private/converter.h" #include "wx/qt/private/utils.h" @@ -106,8 +107,8 @@ wxRegion::wxRegion(const wxBitmap& bmp, const wxColour& transp, int tolerance) return; } - unsigned char raw[bmp.GetWidth()*bmp.GetHeight()]; - memset(raw, 0, bmp.GetWidth()*bmp.GetHeight()); + wxScopedArray raw(bmp.GetWidth()*bmp.GetHeight()); + memset(raw.get(), 0, bmp.GetWidth()*bmp.GetHeight()); QImage img(bmp.GetHandle()->toImage()); int r = transp.Red(), g = transp.Green(), b = transp.Blue(); @@ -125,7 +126,7 @@ wxRegion::wxRegion(const wxBitmap& bmp, const wxColour& transp, int tolerance) } } - m_refData = new wxRegionRefData(QBitmap::fromData(bmp.GetHandle()->size(), raw)); + m_refData = new wxRegionRefData(QBitmap::fromData(bmp.GetHandle()->size(), raw.get())); } bool wxRegion::IsEmpty() const