PDA

View Full Version : QCodec destructor problem



morya
29th November 2007, 04:10
I am learning the QT examples.
When I go into the Codec example,
tools/codecs/mainwindow.cpp
I found line 91 the object QTextCodec 's subclass is created, but I can't find where it has been deleted,
will it cause memory leackage ?


foreach (int mib, QTextCodec::availableMibs()) {
QTextCodec *codec = QTextCodec::codecForMib(mib);

QString sortKey = codec->name().toUpper();
int rank;

if (sortKey.startsWith("UTF-8")) {
rank = 1;
} else if (sortKey.startsWith("UTF-16")) {
rank = 2;
} else if (iso8859RegExp.exactMatch(sortKey)) {
if (iso8859RegExp.cap(1).size() == 1)
rank = 3;
else
rank = 4;
} else {
rank = 5;
}
sortKey.prepend(QChar('0' + rank));

codecMap.insert(sortKey, codec);
}

ChristianEhrlicher
29th November 2007, 07:09
And don't see a 'new QTextCodec' anywhere - so why do you think there's a memleak?