In QWin32PrintEnginePrivate::initialize(), the PRINTER_INFO_2 has a member named pDevMode. On some printers pDevMode is set to NULL after the call to GetPrinter().
In many places Qt checks that devMode isn't null before dereferencing it. In other places it doesn't and it causes a crash, such as in these functions:
QWin32PrintEnginePrivate::setPageSize(const QPageSize &pageSize)
QWin32PrintEngine::property(PrintEnginePropertyKey key) const
QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &value)
Regardless, it removes a lot of functionality if devMode is NULL.
Attached is a suggested solution which uses a reliable backup method to get a pointer to the DEVMODE structure when the first method fails.
|For Gerrit Dashboard: QTBUG-44349|
|105782,7||Improved Windows printer support and fixed crashes due to NULL devMode||5.4||qt/qtbase||Status: MERGED||+2||0|