Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-44349

Unhandled case with certain printers

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.4.2
    • 5.3.0, 5.4.0
    • GUI: Printing
    • 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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            superfun Mike Kuta
            superfun Mike Kuta
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes