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

Unhandled case with certain printers

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.3.0, 5.4.0
    • Fix Version/s: 5.4.2
    • Component/s: GUI: Printing
    • Labels:
      None
    • Environment:
      Windows
    • Commits:
      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

        1. qpagesetupdialog_win.cpp
          6 kB
        2. qprintengine_win_p.h
          7 kB
        3. qprintengine_win.cpp
          56 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              superfun Mike Kuta
              Reporter:
              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