Commit c2c5ac4f authored by Boudewijn Rempt's avatar Boudewijn Rempt

KoID: Don't copy klocalized string

We use KoID as if it were an implicitly shared data class, and that
was mostly true as long as it only contained two QStrings. But copying
the KLocalizedString invalidates that assumption: copying that is
very expensive.

See the trace with bug 300285.

CCBUG:300285
parent d1ac6a26
......@@ -60,9 +60,22 @@ public:
: m_id(id),
m_localizedString(name) {}
KoID(const KoID &rhs)
{
m_id = rhs.m_id;
if (rhs.m_name.isEmpty()) {
m_name = rhs.m_localizedString.toString();
}
else {
m_name = rhs.m_name;
}
}
QString id() const {
return m_id;
}
QString name() const {
if(m_name.isEmpty()) m_name = m_localizedString.toString();
return m_name;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment