If kfontview is called with a fontconfig: URL, it crashes with an assert: kfontview "fontconfig:Arial" ASSERT: "uint(i) < uint(size())" in file /usr/kde4/include/QtCore/qstring.h, line 701 If it is called with a font file pathname, this does not happen. Unfortunately the "Open in Font Viewer" action in the Font Management systemsettings module (kcmshell4 fontinst) calls it with a fontconfig URL in the form "fontconfig:Arial?style=5268480". The crash therefore happens every time this action is used. I have not been able to get a backtrace of the assert, but by adding kDebug()'s it happens in kdeworkspace/kcontrol/kfontinst/viewpart/FontViewPart.cpp within void CFontViewPart::previewStatus(bool st): else if(!FC::decode(url()).family.isEmpty()) printable=!Misc::isHidden(FC::getFile(url())); Here FC::getFile(url()) returns a null string (the correct result) and Misc::isHidden() asserts because it tries to access the character at index 0 of that null string. Reproducible: Always Steps to Reproduce: 1. Run 'kcmshell4 fontinst' 2. Right click over a font in the list, and choose "Open in Font Viewer" Or: 1. Run 'kfontview fontconfig:NAME' where NAME is the name of an installed font. Actual Results: Crash (of kfontview, not of systemsettings) Expected Results: No crash Patch to fix: --- a/kcontrol/kfontinst/lib/Misc.h +++ b/kcontrol/kfontinst/lib/Misc.h @@ -59,7 +59,7 @@ namespace Misc }; extern KDE_EXPORT QString prettyUrl(const KUrl &url); - inline KDE_EXPORT bool isHidden(const QString &f) { return QChar('.')==f[0]; } + inline KDE_EXPORT bool isHidden(const QString &f) { return f.startsWith(QChar('.')); } inline KDE_EXPORT bool isHidden(const KUrl &url) { return isHidden(url.fileName()); } extern KDE_EXPORT bool check(const QString &path, bool file, bool checkW=false); inline KDE_EXPORT bool fExists(const QString &p) { return check(p, true, false); }
Patch looks trivial, can you commit it to 4.11 branch?
Git commit 70fce20035225b948d87698547f1cb9d31a1f891 by Jonathan Marten. Committed on 17/09/2013 at 09:12. Pushed by marten into branch 'KDE/4.11'. kfontview: do not crash when given a fontconfig: URL M +1 -1 kcontrol/kfontinst/lib/Misc.h http://commits.kde.org/kde-workspace/70fce20035225b948d87698547f1cb9d31a1f891
Git commit 81cf614cf1b6736bbd441e2b52ea44bb33a1d79d by Jonathan Marten. Committed on 17/09/2013 at 09:12. Pushed by marten into branch 'master'. kfontview: do not crash when given a fontconfig: URL M +1 -1 kcontrol/kfontinst/lib/Misc.h http://commits.kde.org/kde-workspace/81cf614cf1b6736bbd441e2b52ea44bb33a1d79d