Results 1 to 2 of 2

Thread: segfault while trying to access QList

  1. #1
    Join Date
    Jan 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Question segfault while trying to access QList

    I am a bit stuck on a small project I am working on. It's supposed to access a SugarCRM instance via SOAP.

    Now I have implemented most of the stuff I need, but there is one thing that keeps crashing the app since I last refactored.
    There are Accounts and Contacts and both can have Notes. So i implemented the method for fetching Notes in a common class the Accounts and Contacts can inherit from. Since my C++ is anything else but professional, the attempt to access said Notes fails in a segfault.

    In http://github.com/Raven24/FSugar/blo...stractitem.cpp on line 27 the method populating the Notes starts. http://github.com/Raven24/FSugar/blo...itemdetail.cpp on line 74 the Notes are put into a model and should be displayed in a QTableView. The model is in http://github.com/Raven24/FSugar/blo...notesmodel.cpp and the segfault happens while attempting to sort the list in the method on line 128.

    The people at #qt already told me that in AbstractItemDetail the member 'item' probably doesn't get initialised. That should be taken care of by the subclass AccountDetail - at least that's what I think it does.
    Any help is gladly appreciated!

    P.S: When you want to checkout the whole project, make sure you use the 'widgets' branch. 'master' doesn't work...

  2. #2
    Join Date
    Jan 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: segfault while trying to access QList

    lastest research in the interwebs has shown, that the problem seems to be me shadowing the 'item' from AbstractItemDetail in AccountDetail. Thus methods in AbstractItemDetail can only access an uninitialised pointer... I have to look into dynamic inheritance and polymorphism again, I guess.

Similar Threads

  1. Copying an QList into a new, sorted QList.
    By Thomas Wrobel in forum Newbie
    Replies: 3
    Last Post: 11th January 2010, 18:27
  2. QList: Out of memory - without having defined QList
    By miroslav_karpis in forum Qt Programming
    Replies: 1
    Last Post: 27th March 2009, 08:42
  3. Weird Segfault...
    By chimby in forum Qt Programming
    Replies: 3
    Last Post: 22nd January 2009, 23:31
  4. Segfault
    By Dumbledore in forum Qt Programming
    Replies: 3
    Last Post: 12th November 2007, 07:31
  5. segfault
    By conexion2000 in forum Qt Programming
    Replies: 1
    Last Post: 31st May 2006, 12:34

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.