Results 1 to 1 of 1

Thread: Slight change leads to segmentation fault in qt example

  1. #1
    Join Date
    Oct 2009
    Posts
    18
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Slight change leads to segmentation fault in qt example

    Hello.
    I have just compiled the simpetreemodel example that comes with the qt sources. That worked fine.
    But this slight change to the treemodel constructor (the last two lines with the x variable) gives me a segmentation fault. Does anyone know why? To me it is a mystery and I must have failed to understand something very basic?

    Qt Code:
    1. TreeModel::TreeModel(const QString &data, QObject *parent)
    2. {
    3. QList<QVariant> rootData;
    4. rootData << "Title" << "Summary";
    5. rootItem = new TreeItem(rootData);
    6. setupModelData(data.split(QString("\n")), rootItem);
    7.  
    8. TreeItem* x = new TreeItem(rootData);
    9. rootItem->appendChild(x);
    10. }
    To copy to clipboard, switch view to plain text mode 

    I should add that I just wanted to try to add an extra item. But it seems that did not work.
    Last edited by codemonkey; 24th January 2010 at 10:30. Reason: extra information

Similar Threads

  1. Segmentation fault
    By impeteperry in forum Qt Programming
    Replies: 5
    Last Post: 29th December 2008, 18:59
  2. segmentation fault
    By uchennaanyanwu in forum Newbie
    Replies: 3
    Last Post: 31st July 2008, 16:52
  3. Segmentation Fault?!
    By r07f1 in forum Newbie
    Replies: 2
    Last Post: 11th April 2008, 15:10
  4. segmentation fault
    By mattia in forum Newbie
    Replies: 22
    Last Post: 7th November 2007, 10:37
  5. (Another) segmentation fault
    By Lebowski in forum Qt Programming
    Replies: 27
    Last Post: 6th April 2006, 06:33

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.