diff --git a/src/printsupport/platform/macos/qpaintengine_mac.mm b/src/printsupport/platform/macos/qpaintengine_mac.mm index 27274f116ed..a2c08b416bf 100644 --- a/src/printsupport/platform/macos/qpaintengine_mac.mm +++ b/src/printsupport/platform/macos/qpaintengine_mac.mm @@ -256,10 +256,10 @@ static void qt_mac_draw_pattern(void *info, CGContextRef c) CGDataProviderRelease(provider); #else const int numBytes = (w*h)/sizeof(uchar); - uchar xor_bytes[numBytes]; + QVarLengthArray xor_bytes(numBytes); for (int i = 0; i < numBytes; ++i) xor_bytes[i] = pat->data.bytes[i] ^ 0xFF; - CGDataProviderRef provider = CGDataProviderCreateWithData(nullptr, xor_bytes, w*h, nullptr); + CGDataProviderRef provider = CGDataProviderCreateWithData(nullptr, xor_bytes.constData(), w*h, nullptr); CGImageRef swatch = CGImageMaskCreate(w, h, 1, 1, 1, provider, nullptr, false); CGDataProviderRelease(provider);