Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.3.0, 5.4.0
-
None
-
Windows
-
4ca43c71eb4f1b2cb969a219e3f1d3b12af02309
Description
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)
QWin32PrintEnginePrivate::updatePageLayout()
QWin32PrintEngine::property(PrintEnginePropertyKey key) const
QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &value)
QPageSetupDialog::exec()
QWin32PrintEngine::begin()
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.