Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.1.0
-
OSX 10.8.4
-
-
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(); }