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

QPrinter.setPaperSize crash app

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Duplicate
    • Affects Version/s: 5.4.0
    • Fix Version/s: None
    • Component/s: GUI: Printing
    • Labels:
      None
    • Environment:
      Windows 7 64bit, Mingw 4.9.1 (32bit)

      Description

      Using code like this:

      QPrintPreviewDialog ppd;
      QObject::connect(&ppd, SIGNAL(paintRequested(QPrinter*)), this, SLOT(request(QPrinter*)));
      ppd.exec();
      
      ...
      
      void MainWindow::request(QPrinter *printer) {
          ui->textBrowser->print(printer);
      }
      

      Dialog show a empty preview.

      Using like this the app crash:

      //Note: no added printer var to ppd
      QPrinter printer;
      printer.setPaperSize(QPrinter::A4);
      printer.setPageMargins(20, 20, 20, 20, QPrinter::Millimeter);
      printer.setResolution(300);
      
      QPrintPreviewDialog ppd;
      QObject::connect(&ppd, SIGNAL(paintRequested(QPrinter*)), this, SLOT(request(QPrinter*)));
      ppd.exec();//This line crash app
      

      or (crash too):

      QPrinter printer;
      printer.setPaperSize(QPrinter::A4);
      printer.setPageMargins(20, 20, 20, 20, QPrinter::Millimeter);
      printer.setResolution(300);
      
      QPrintPreviewDialog ppd(&printer);
      QObject::connect(&ppd, SIGNAL(paintRequested(QPrinter*)), this, SLOT(request(QPrinter*)));
      ppd.exec();//This line crash app
      

      When app crash show this message:

      QWin32PrintEngine::initialize: CreateDC failed ()
      QWin32PrintEngine::initialize: CreateDC failed ()
      Error - RtlWerpReportException failed with status code :-1073741823. Will try to launch the process directly

        Attachments

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

          Activity

            People

            • Assignee:
              kkohne Kai Köhne
              Reporter:
              brcontainer Guilherme Nascimento
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes