Crash on print of file with copyright symbol
Windows 7, GIT commit: b424d8e
In general, I have no problems printing from the development builds, whether running under debugger or not. However, attempting to print the attached score (or any of its parts) crashes immediately upon pressing Ctrl+P. Debugger shows no useful stack trace for me - it appears to be deep inside DLL's, with nothing to indicate where the code last was within MuseScore:
0 ?? 0xae494176
1 SHLWAPI!SHCreateThreadWithHandle C:\Windows\syswow64\shlwapi.dll 0x763042a3
2 SetCurrentProcessExplicitAppUserModelID C:\Windows\syswow64\shell32.dll 0x76c9976e
3 SHLWAPI!SHCreateThreadWithHandle C:\Windows\syswow64\shlwapi.dll 0x763042b6
4 SHELL32!RealDriveType C:\Windows\syswow64\shell32.dll 0x76cf1d47
5 SHELL32!RealDriveType C:\Windows\syswow64\shell32.dll 0x76cf3110
6 USER32!OffsetRect C:\Windows\syswow64\user32.dll 0x756d62fa
7 ?? 0x1805ec
8 ?? 0x8000
9 ??
Attachment | Size |
---|---|
Different_Worlds.mscz | 62.86 KB |
Comments
Stepping through the code, the crash occurs on the exec() call for the print dialog in MuseScore::printFile(). I can't really see how this score could be so messed up that this would happen. Looking at the score file itself, I see a bad character in the copyright field, but other scores of mine have this too and don't crash MuseScore. And printing is the only thing that seems to go wrong in this score - I can work with it in other respects (including generating PDF) with no problems.
What about the page format?
As far as I can tell, it's exactly what I use in another score. Nothing special - just the default (Letter size for me) but with space turned down to 1.7 and all left & right margins set to 10mm.
Hmm, with my most recent build (from current sources - 0688c68360 - the specific behavior has changed. I can't even load the score correctly any more. But after a little experimentation, it seems to be all about the copyright character.
Since we no longer have a way of entering this symbol directly into MuseScore - a decision I still would very much like to see reversed - I have been resorting to going to Google Docs, typing "(c)", letting it convert that to the copyright symbol, then copying and pasting this into the copyright field of my score. And I find now now that any score created this way will crash for me upon printing:
1) Press Ctrl+N to start "Create New Score" wizard
2) go to Google Docs, type "(c) ", select resulting copyright symbol, Ctrl+C
3) go back to MuseScore, click in Copyright field, press Ctrl+V
4) finish creating score - I made it for Flute, all default settings
5) save (this step appears necessary even though we do not then close & reload)
6) Ctrl+P
Result: crash, same place in code
The crash is not reproducible on linux for me. Maybe its a windows only problem.
Unfortunately, it *does* still crash for me. Of course, it makes no sense at all that the content of the copyright field should interfere with the ability to create a QPrinter object. Since it crashes whether running under the debugger or not, I am assuming this is *not* a case of https://bugreports.qt-project.org/browse/QTBUG-14048. Although actually, the symtpoms *are* different depending on whether I am under debugger or not. Under debugger, the scores I original posted crashes *immediately* upon pressing Ctrl+P. Not under debugger, the dialog starts to be drawn first. And a score created from scratch crashes *only* under debugger.
I'll keep investigating. I am thinking something is somehow getting corrupted in memory (and the spurious control character that gets written to the copyright tag in the MSCX file may be evidence of this), and that this memory corruption is what is actually triggering the crash.
Making some progress, maybe. The problem is definitely not about printing specifically. Here's a question for anyone: if you load the attached scores, what do you see?
For copyright-character.mscx, I see a score with 32 empty measures and a copyright symbol at the bottom of the page (that's the copyright tag in the footer).
For copyright-character-2.mscx, I see an entirely blank page. No measures, no copyright symbol in the footer.
The first file is what I saved in following the steps in #4 above. When I examine the file in a text editor, I see a spurious control character in front of the copyright symbol in the copyright tag. The second file is the result of deleting that character and saving.
Can someone load these scores and tell me what you see? Also, does printing either of them crash (immediately upon hitting Ctrl+P) for anyone else?
Confirmed first score contents and look. Prints OK with Ctrl-P.
Confirmed second score lack of contents. Prints a blank page OK with Ctrl-P.
No crashes.
My suspicion is that "spurious" character is the Unicode encoding for (c). With just the one non-ASCII character (A9) in the string, something's getting mucked up.
As a side question, how often do you full recompile MS, and do you remove your workspace every so often for troubleshooting issues? When I start having strange problems, I will do a full compile, and if bad things continue, then remove all the MuseScore files in under both Appdata locations.
Thanks for checking! What OS were you on?
You're probably right about the Unicode. I wouldn't have thought this would cause problems - the copyright symbol is a valid one-byte ASCII character as well. But for now, I'll accept that MuseScore doesn't like this as a one-byte character and not worry about that particular symptom. My real concern remains the crash on print, and I remain suspicious that somehow reading and writing the copyright character causes some sort of memory corruption (perhaps *caused* by confusion about whether that symbol is one byte or two?)
I also get the same results if I try to paste the copyright symbol into a staff text - it's not just the copyright field. That is, if I create a staff text and paste the copyright character in, I can print if I do it before saving, but after a save, Ctrl+P crashes. And same if then reload the file.
BTW, I do full recompile whenever someone changes a header file :-), which is practically daily. I clean my AppData folders semi-regularly; just did it yesterday in fact.
I'm on Win 8.1 64-bit.
I just wished the factory reset removed those two folders, instead of how it is now. Twould save some digging around to do a manual reset.
I currently can not duplicate this, but since I can't think of any thing that has really changed that would have fixed this, I'm suspicious. I'm leaving this open for now, and it's on my hit list to come back and check on later.
There is no crash neither in 2.3.1 nor in 3.0. Btw, the score is empty in 3.0: #274300: Pre-2.0 score looks empty in 3.0
Automatically closed -- issue fixed for 2 weeks with no activity.