Results 1 to 2 of 2

Thread: QListWidget crashes when trying to clear

  1. #1
    Join Date
    Mar 2014
    Posts
    18
    Thanks
    3
    Qt products
    Qt3 Qt4 Qt/Embedded

    Default QListWidget crashes when trying to clear

    Hi All,

    I have a list, that I fill with a QStringList. That works.
    When I select an item, I want the list to be cleared and then filled with another QStringList.
    The problem is, that when I click on one of the items, my whole Programme crashes, because of the following Error:

    Qt Code:
    1. Invalid parameter passed to C runtime function.
    2. Invalid parameter passed to C runtime function.
    3. Error - RtlWerpReportException failed with status code :-1073741823. Will try to launch the process directly
    4. terminate called after throwing an instance of 'std::out_of_range'
    5. what(): vector::_M_range_check
    To copy to clipboard, switch view to plain text mode 


    my function for the Listwrite is the following:

    Qt Code:
    1. void layout1::writeResultList(QStringList results){
    2. ui->list->clear();
    3. ui->list->addItems(results);
    4. }
    To copy to clipboard, switch view to plain text mode 

    Does anyone have an idea, why it crashes?

    Thanks.

  2. #2
    Join Date
    Oct 2009
    Posts
    483
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QListWidget crashes when trying to clear

    There seems to be an out-of-bounds access on an std::vector somewhere in the program. This may or may not be directly related to what you do in writeResultList(). First of all, you should try step-by-step debugging to see what statement causes the crash. Secondly, we cannot do much unless we see the complete source of your program.

Similar Threads

  1. QListWidget->clear()
    By Charvi in forum Qt Programming
    Replies: 7
    Last Post: 14th August 2012, 08:30
  2. Replies: 3
    Last Post: 7th February 2012, 21:19
  3. Replies: 2
    Last Post: 1st April 2011, 10:32
  4. QListWidget - clear()
    By Carlsberg in forum Qt Programming
    Replies: 3
    Last Post: 3rd June 2010, 08:01
  5. How can i clear the rawData?
    By Vincenzo in forum Qwt
    Replies: 1
    Last Post: 15th March 2009, 12:45

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.