~laney/ubuntu-system-settings/battery-charge-graph

« back to all changes in this revision

Viewing changes to src/item-model.cpp

  • Committer: Tarmac
  • Author(s): Iain Lane
  • Date: 2013-11-19 18:37:44 UTC
  • mfrom: (492.1.1 ubuntu-system-settings)
  • Revision ID: tarmac-20131119183744-b1xaa8hx72ltt8un
When generating the translated list of keywords, keep the byte array alive for as long as it's needed. Fixes: https://bugs.launchpad.net/bugs/1251729.

Approved by Sebastien Bacher, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
108
108
        ret = QVariant::fromValue<QObject*>(const_cast<Plugin*>(item));
109
109
        break;
110
110
    case KeywordRole:
111
 
        const char * domain = item->translations().toUtf8().constData();
 
111
        QByteArray translations = item->translations().toUtf8();
 
112
        QByteArray displayName = item->displayName().toUtf8();
 
113
        const char * domain = translations.constData();
112
114
        QStringList temp(item->keywords());
113
115
        QMutableListIterator<QString> it(temp);
114
116
        while (it.hasNext()) {
119
121
                                keyword.toUtf8().constData())));
120
122
        }
121
123
        temp << QString::fromUtf8(
122
 
                dgettext(domain,
123
 
                         item->displayName().toUtf8().constData()));
 
124
                    dgettext(domain,displayName.constData()));
124
125
        ret = temp;
125
126
    }
126
127