Results 1 to 2 of 2

Thread: QCodec destructor problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2007
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Question QCodec destructor problem

    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 ?
    Qt Code:
    1. foreach (int mib, QTextCodec::availableMibs()) {
    2. QTextCodec *codec = QTextCodec::codecForMib(mib);
    3.  
    4. QString sortKey = codec->name().toUpper();
    5. int rank;
    6.  
    7. if (sortKey.startsWith("UTF-8")) {
    8. rank = 1;
    9. } else if (sortKey.startsWith("UTF-16")) {
    10. rank = 2;
    11. } else if (iso8859RegExp.exactMatch(sortKey)) {
    12. if (iso8859RegExp.cap(1).size() == 1)
    13. rank = 3;
    14. else
    15. rank = 4;
    16. } else {
    17. rank = 5;
    18. }
    19. sortKey.prepend(QChar('0' + rank));
    20.  
    21. codecMap.insert(sortKey, codec);
    22. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodec destructor problem

    And don't see a 'new QTextCodec' anywhere - so why do you think there's a memleak?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.