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

OSX 10.8.4: QPrinter::setPaperName() causes a crash

    XMLWordPrintable

Details

    • macOS
    • 3e078cf36db538c95fd9b491a69196e882c24e0a

    Description

      The following example code will crash when requesting QPrinter::printerName() after setting paperName with QPrinter::setPaperName().

      Crash only occurs on 10.8, 10.7 is working fine.

      main.cpp
      #include "mainwindow.h"
      #include <QApplication>
      
      #include <QPrinter>
      #include <QPrinterInfo>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          MainWindow w;
          w.show();
          QPrinter * printer = new QPrinter();
          QPrinterInfo pInfo(*printer);
          QList<QPair<QString, QSizeF> > papers = pInfo.supportedSizesWithNames();
          if(papers.size() != 0){
              //Calling setPaperName causes us to crash comment this line out and it works.
              //This works on OSX 10.7 Crashes on OSX 10.8.
              printer->setPaperName(papers.begin()->first);
              w.setWindowTitle(papers.begin()->first);
          }
      
          QString pName = printer->printerName();
          printer->setPrinterName(pName);
      
          return a.exec();
      }
      

      Attachments

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

        Activity

          People

            andysh Andy Shaw
            kileppal Kimmo Leppälä
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes