Qt 5.5 print bug on Windows?
-
Hi,
the application I work on crashes on Windows if I
- print a page
- choose the 'Microsoft XPS Document Writer' printer and
- press the button cancel when the system asks me the name of the XPS file
At first I thought the error was in my application but I found that the same happens in QtCreator.
In my case the crash happens in the slot connected to the signalpaintRequested()
of my QPrintPreviewWidget subclass:void LabelsPrintPreviewWidget::printLabels(QPrinter *printer) { if (!printer->isValid()) return; QPainter painter(printer); <- HERE ... }
The dialog to choose the name of the XPS file is shown when the line
QPainter painter(printer);
is executed and if I click on the Cancel button the application crashes.Does anybody know if this an error in my application (and QtCreator) or is it a bug in Qt 5.5 (on Windows)?
Thanks
ciao
riki -
Hi and welcome to devnet,
If you can reproduce this with a minimal compilable example then it's likely a bug. You should check the bug report system to see if it's something known.
-
Thanks SGaist,
I searched in the bug report system but did not find a similar issue so I submitted a new bug report (QTBUG-48203).
-
Thanks for sharing the link
-
From the bug report you get to the fix on Gerrit: https://codereview.qt-project.org/126691
This fix was submitted to the 5.5 branch, but I cannot tell you if it is contained in a 5.5.x version. The bug report mentions it is in 5.6.
So yes, upgrading to Qt 5.6 is the official solution.
Or you can also build Qt yourself from the 5.5 branch, which contains the fix.
https://wiki.qt.io/Building_Qt_5_from_Git contains the steps needed for this.