Results 1 to 2 of 2

Thread: Bad memory during endInsertRows

  1. #1
    Join Date
    Apr 2010
    Posts
    77
    Thanks
    10
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Bad memory during endInsertRows

    Hi Guys

    I have a tree model (QAbstractItemModel) with a QSortFilterProxyModel.
    I've drag drop enabled it so that I can drag a node in the QTreeview and drop it under any other node in the same QTreeView.

    It usually works fine except that occasionally it crashes during endInsertRows() with a bad memory access.
    For instance, there is one scenario that will crash each time I run it, 9 times out of 10 but not absolutely every time.

    During debug - whilst it crashes during endInsertRows() it appears to specifically crash at QSortFilterProxyModel:arent.

    My question is does anyone have suggestions for what I should be looking for to fix this?
    What exactly does endInsertRows() do?

    There is probably no point in posting the code - there is a lot of it.

    Thanks
    Jeff

  2. #2
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Bad memory during endInsertRows

    Create minimal compilable example of the issue and post it here.
    In most cases when creating the example you will find mistake you made in the first place.

    Check item that parent() is called on for null pointer.
    My guess would be that you've deleted (or moved) something without updating model correctly.

  3. The following user says thank you to Spitfire for this useful post:

    Jeffb (16th April 2012)

Similar Threads

  1. Replies: 3
    Last Post: 14th April 2011, 14:13
  2. A way to know the memory use ?
    By tonnot in forum Newbie
    Replies: 4
    Last Post: 23rd February 2011, 09:30
  3. memory corruption
    By Rambobino in forum Qt Programming
    Replies: 2
    Last Post: 10th August 2010, 21:35
  4. memory leaks
    By Fastman in forum Qt Programming
    Replies: 1
    Last Post: 5th March 2008, 08:00
  5. memory leak
    By mattia in forum Newbie
    Replies: 18
    Last Post: 16th January 2008, 10:22

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
  •  
Qt is a trademark of The Qt Company.