X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fuisupport%2Fuistyle.cpp;h=e04a0bd0508987d8b72416867ab4491aed87b4ef;hb=444e91f948b435e652205c4d0f1148906e9e86dc;hp=017fee24689efd5e6953fe4587bafd7d5d1c4b57;hpb=5ee9c75fb9301473d40ca1f219201950529096f7;p=quassel.git diff --git a/src/uisupport/uistyle.cpp b/src/uisupport/uistyle.cpp index 017fee24..e04a0bd0 100644 --- a/src/uisupport/uistyle.cpp +++ b/src/uisupport/uistyle.cpp @@ -129,7 +129,10 @@ QString UiStyle::formatCode(FormatType ftype) const { return _formatCodes.key(ftype); } -UiStyle::StyledText UiStyle::styleString(QString s) { +UiStyle::StyledText UiStyle::styleString(const QString &_s) { + QString s = _s; // we can't use call-by-value since this seems to maybe screw up Qt's implicit sharing somehow + // at least invalid formats are created if we do that + StyledText result; QList fmtList; fmtList.append(None); @@ -137,7 +140,7 @@ UiStyle::StyledText UiStyle::styleString(QString s) { curFmtRng.format = format(None); curFmtRng.start = 0; result.formats.append(curFmtRng); - int pos = 0; int length; + int pos = 0; int length = 0; int fgCol = -1, bgCol = -1; // marks current mIRC color for(;;) { pos = s.indexOf('%', pos);