Results 1 to 3 of 3

Thread: qDeleteAll() and linked list iterators

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2010
    Posts
    34
    Thanks
    1
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qDeleteAll() and linked list iterators

    What are you trying to do exactly?
    Do you want to make it use qDeleteAll, or what?

    By the way, the implementation of the "node" struct is very confusing. The item given to be stored is copied in the ctor using shallow copy, but then you delete it in the dtor like it were a deep copy. This will lead to troubles.

  2. #2
    Join Date
    May 2010
    Posts
    14
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: qDeleteAll() and linked list iterators

    I just threw that together real quick. That should be a pointer to the stored value, rather than a shallow copy (looking for edit button).

    What it's supposed to demonstrate is a valid STL iterator that requires the dereferenced value of the iterator to increment. qDeleteAll(...) deletes the dereferenced value before iterating. Resulting in a memory access error on iteration.

Similar Threads

  1. Trouble implementing a linked list.
    By Bonafide in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2010, 21:13
  2. corrupted double-linked list
    By reuabreliz in forum Installation and Deployment
    Replies: 2
    Last Post: 6th January 2010, 13:15
  3. Replies: 26
    Last Post: 21st July 2007, 21:34
  4. QLinkedList and iterators
    By eu.x in forum Newbie
    Replies: 1
    Last Post: 19th April 2007, 19:38
  5. Linked List
    By merry in forum Qt Programming
    Replies: 10
    Last Post: 14th March 2007, 07:07

Tags for this Thread

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.