diff --git a/src/plugins/printsupport/windows/qwindowsprintdevice.cpp b/src/plugins/printsupport/windows/qwindowsprintdevice.cpp index 0a21193216..0feea5ea74 100644 --- a/src/plugins/printsupport/windows/qwindowsprintdevice.cpp +++ b/src/plugins/printsupport/windows/qwindowsprintdevice.cpp @@ -280,11 +280,11 @@ void QWindowsPrintDevice::loadResolutions() const { DWORD resCount = DeviceCapabilities((LPWSTR)m_id.utf16(), NULL, DC_ENUMRESOLUTIONS, NULL, NULL); if (int(resCount) > 0) { - QScopedArrayPointer resolutions(new LONG[resCount*sizeof(LONG)]); + QScopedArrayPointer resolutions(new LONG[resCount*2]); // Get the details and match the default paper size if (DeviceCapabilities((LPWSTR)m_id.utf16(), NULL, DC_ENUMRESOLUTIONS, (LPWSTR)resolutions.data(), NULL) == resCount) { - for (int i = 0; i < int(resCount); ++i) - m_resolutions.append(resolutions[i]); + for (int i = 0; i < int(resCount * 2); i += 2) + m_resolutions.append(resolutions[i+1]); } } m_haveResolutions = true;