segmentation fault when trying to print
I have a problem which has cropped up on my Linux system. Now, when I try to print a score, my MuseScore crashes with a segmentation fault. This happens as soon as I click on the print icon. I replaced my MuseScore with the new 2.0-Beta-2, that did not make a difference. I can still print from my MuseScore-1.3. I suspect that something has been updated on my computer and that a dependency is now missing, or a library, etc. I am compiling from source on 64-bit Gentoo Linux. Any assistance in troubleshooting would be appreciated. My printing from MuseScore-2.0 was working a few months ago.
Comments
When you say you replaced your MuseScore with the new 2.0 Beta 2 (which, at this point, is over a month old; you might yet try a nightly build), what were you using before? And did you run "make install" and run from the installation folder?
Only other thing I can think to ask is if you have a default printer installed and if it's available.
Also, in the future, it's better to use the forum (Technology Preview) for support, and save the issue tracker for when you have something with clear steps to reproduce. Although I realize this is probably reproducible for you.
I guess I didn't know the difference between forum and issue trackers -- too many choices. I did install with make install, then I rename the install binary in /usr/local/bin so I can keep track of it, and point a symbolic link to it, which is what is fired up from my desktop. The issue has nothing to do with printers, the crash occurs as soon as I hit the print button (before any print dialog appears), which would normally let me choose to print a pdf to file, or print directly to a printer, etc. Is it possible this is something with qt5 components? When I fire up the musescore in debug mode, I get nothing I see as helpful. The last 3 lines are:
libpng warning: iCCP: known incorrect sRGB profile
MuseScore::cmd
Segmentation fault
I had been compiling from the git repository. The last version I had used when it was working was from the git as of October 17. I know it printed with that version on October 20. I refreshed from the git repository and recompiled on December 18, and successfully printed that day. Then that same version failed on January 15 to print, having done some routine updates on my system in the meantime. It is then that I first updated from the git hub, recompiled and installed, and tried that version, to no avail, and then instead, I downloaded, compiled, and installed the Beta-2 version, and that had the same result.
Hence, I am looking for what might be the culprit. Is there anything more in the way of debugging other than running with a -d switch that might reveal more information?
It is possible it is Qt related, but it seems not terribly likely if the same built version worked one day and not the next. Unless the "routine updates" on your system involved updating Qt.
I wouldn't be so sure it isn't related to printers. I get that the crash happens before the dialog comes up, but the dialog would normally be pro-populated with info from your default printer. So if there is some issue accessing that, maybe that would epxlain the problem.
Running under an actual debugger would be the way to get more info. Are you using QtCreator? If so, then running under that would be the way to go. Otherwise, and if its too much bother to set up QtCreator, you could run under gdb directly, although I have no idea how to do that. but you'd get a stack trace, and the state of local variables, which even if you don't know anything about programming would allow you to provide us with information.
Routine updates did include upgrade of qt components from 5.3.2 to 5.4.0 on December 25, which would coincide with the time frame of the breakage. QtCreator is installed, but I don't know anything about it.
Without knowing exactly what I am doing, I did fire up qtcreator in debug mode to watch the MuseScore and it seems to point to line 1483 of file.cpp, a line of code that says:
if (!pd.exec())
as the point where the segmentation fault (Signal SIGSEGV) occurs.
The other information provided shows:
MuseScore::printFile():void
That is interestng information indeed, but it does leave me mystified. It says the crash occurred while trying to display the print dialog. As I mentioned, I could imagine this being the case if something was weird about your system default printer. The update to Qt definitely sounds suspicious, but I'm running Qt 5.4 too and I don't have problems with the print dialog.
Have you tried reverting to factory settings - running "mscore -F"? Not sure that should change anything, but then again, it shouldn't be crashing in the first place.
I did do a bit of research, and today I found a Gentoo bug report, bug #532140, which seems too similar to ignore. The description is: dev-qt/qtprintsupport-5.4.0 - any executable using QPrintDialog: segmentation fault in QPrintDialog::qt_metacast(char const*) () from /usr/lib64/libQt5PrintSupport.so.5
I think I will see if I can revert back to qt-5.3.2 and see if the symptom goes away. All of the qt5 from Gentoo is not yet marked as stable.
That looks like it, indeed - well done! I gather from the discussion that it is not a bug with Qt 5.4 in general but with the particular it is compiled for gentoo.
We don't really have a good status for this sort of thing, but closing it seems as sensibl as anything else.
I can report, for what it is worth, in case anyone else runs into this same issue, that reverting my Qt5 back to 5.3.2 solved this problem. The print button now brings up the print dialog instead of crashing with a segmentation fault.
The libpng warning has been fixed now