Results 1 to 1 of 1

Thread: There seams to be a memoryleak in Border Layout Example

  1. #1
    Join Date
    Sep 2016
    Posts
    3
    Qt products
    Qt5
    Platforms
    Windows Android

    Default There seams to be a memoryleak in Border Layout Example

    Hi,

    there seams to be a memoryleak in Border Layout Example. The class BorderLayout holds a list of pointers to ItemWrapper. The ItemWrapper itself will not deleted in the deconstructor of BorderLayout. Followed my fixed version:

    BorderLayout::~BorderLayout()
    {
    QLayoutItem *l; ItemWrapper*w;
    for (int i = 0; i < list.count(); i++)
    {
    w = (ItemWrapper*)list.at(i);
    delete w->item;
    delete w;
    }
    list.clear();
    // while ((l = takeAt(0)))
    // delete l;
    }
    Last edited by FSDrake; 27th September 2016 at 15:56.

Similar Threads

  1. Replies: 10
    Last Post: 9th September 2013, 16:29
  2. Replies: 3
    Last Post: 17th May 2013, 09:00
  3. Replies: 2
    Last Post: 21st March 2012, 15:30
  4. Replies: 0
    Last Post: 25th May 2009, 11:00
  5. Deleting from TreeWidget... Memoryleak
    By VireX in forum Qt Programming
    Replies: 5
    Last Post: 1st June 2007, 22:33

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.