Export a file via a third party PDF printer causes a crash

• May 7, 2015 - 08:41
Type
Functional
Severity
S2 - Critical
Status
closed
Project

Nightly 0bd0092 / Windows7

1) Open this file: test file.mscz
2) File -> Print
3) Choose a PDF printer, e.g. PDFCreator -> Print

Result: crash

-This Nightly on May 5 works: 151c717
- Not the followed on May 6: 499ea8e

Remark: on last update of PDFCreator (2.1)


Comments

And that seems caused by devicePixelRatio() returning 0 (or something less than 1 as actually that function returns a Qreal, not an int, so truncation would occur?), in libmscore/sym.cpp, line 5204:
int pixelRatio = painter->device()->devicePixelRatio();;

This really makes me wonder where compiler warnings are when you need them...

Status (old) active patch (code needs review)

See https://github.com/musescore/MuseScore/pull/1998

This solves the crash, but at least with CC PDF Printer the resulting PDF doesn't look good, all glyphs are missing (cleft, key and time sig, note heads...). I know I had the same issue with Adobe's PDF printer in the past, but seem to remember that CC PDF Printer worked back then?

I don't think that the problem is simply a casting into int.
I think that the device ( painter->device() ) is not set properly, but I don't understand what has changed with respect to the code before the switch to FreeType.
Before FreeType the pixelRatio in the CutePDF Writer case was 1 (I tried with 151c717 Windows 8.1), but this parameter was not used in the code.

Changed it back to int, but also checked whether devicePixelRatio() return 0 and set pixelRatio to 1 in that case.
→ No crash and the resulting PDF looks OK!

No idea though why devicePixelRatio() sometimes return a 0