Hi again,
I have encountered an odd obstacle.
I implement MVC pattern using subclassed QTreeView as myView and QAbstractItemModel as myModel. I place the myView object in MyMVC that contains combo box and line edit, which are used as filter input. Anyway, everything works perfect with the whole application.

But when I add a few (commented below in mymvc.cpp) lines I get Core Dumped and the main window of my program just shows for a while and dissapears.

Above the backtrace I receive:
*** glibc detected *** ./PL09: corrupted double-linked list: 0x08124aa8 ***
(PL09 is a name of a application file)

Here is the code of mymvc.h
Qt Code:
  1. #ifndef MTR_SAFETY_DECLARATION_FOR_MYMVC_H
  2. #define MTR_SAFETY_DECLARATION_FOR_MYMVC_H
  3. #include <QWidget>
  4. namespace MTR {
  5. class Book;
  6. class SBook;
  7. }
  8. class myView;
  9. class myModel;
  10. class QLabel;
  11. class QComboBox;
  12. class QLineEdit;
  13.  
  14. class MyMVC : public QWidget {
  15. Q_OBJECT
  16. public:
  17. MyMVC(QList<MTR::Book>* list = 0, QWidget* parent = 0);
  18. void prodModel(QList<MTR::Book>*);
  19. public slots:
  20. bool getCaseSensitive(void) { return caseSensitive; }
  21. void setCaseSensitive(bool cs) { caseSensitive = cs; }
  22. signals:
  23. void doubleClickInTreeView(int);
  24. private:
  25. QList<MTR::SBook>* slist;
  26. QLineEdit* le;
  27. QComboBox* qcb;
  28. myModel* model;
  29. myView* qtv;
  30. QLabel* label;
  31. bool caseSensitive;
  32. QRadioButton* radioOne;
  33. QRadioButton* radioTwo;
  34. };
  35.  
  36. #endif
To copy to clipboard, switch view to plain text mode 

Then you have mymvc.cpp
Qt Code:
  1. #include "mymvc.h"
  2. #include "myView.h"
  3. #include "sbook.h"
  4. #include "myModel.h"
  5. #include "myHeaderView.h"
  6. #include <QList>
  7. #include <QGridLayout>
  8. #include <QLabel>
  9. #include <QLineEdit>
  10. #include <QComboBox>
  11. #include <QRadioButton>
  12.  
  13. MyMVC::MyMVC(QList<MTR::Book>* list, QWidget* parent) {
  14. slist = new QList<MTR::SBook>();
  15. for(int i = 0;i<list->size();++i) {
  16. slist->append(MTR::SBook(i,list->value(i)));
  17. }
  18. setFixedSize(590,400);
  19.  
  20. le = new QLineEdit();
  21. qcb = new QComboBox();
  22. qcb->addItem(tr("filter by Title"));
  23. qcb->addItem(tr("filter by Author"));
  24. qcb->addItem(tr("filter by Publisher"));
  25. qcb->setCurrentIndex(0);
  26.  
  27. model = new myModel(*slist,le,qcb);
  28. model->filter();
  29.  
  30. qtv = new myView(model);
  31. qtv->header()->setSortIndicator(0,Qt::DescendingOrder);
  32.  
  33. label = new QLabel(tr("Enter a character string below"));
  34. //radioOne = new QRadioButton(tr("Case Sensitive - TRUE"));
  35. //radioTwo = new QRadioButton(tr("Case Sensitive - FALSE"));
  36. //radioOne->setChecked(true);
  37. caseSensitive = true;
  38. qvb = new QGridLayout();
  39. //connect(radioOne,SIGNAL(toggled(bool)),this,SLOT(setCaseSensitive(bool)));
  40. connect(qcb,SIGNAL(currentIndexChanged(int)),le,SLOT(clear()));
  41. connect(qcb,SIGNAL(currentIndexChanged(int)),qtv,SLOT(filter()));
  42. connect(le,SIGNAL(textChanged(const QString &)),qtv,SLOT(filter()));
  43. connect(model,SIGNAL(fromTVtoVM(int)),this,SIGNAL(doubleClickInTreeView(int)));
  44.  
  45. qvb->addWidget(label,0,0);
  46. //qvb->addWidget(radioOne,0,1);
  47. qvb->addWidget(le,1,0);
  48. //qvb->addWidget(radioTwo,1,1);
  49. qvb->addWidget(qcb,2,0,1,2);
  50. qvb->addWidget(qtv,3,0,1,2);
  51. setLayout(qvb);
  52. }
  53.  
  54. void MyMVC::prodModel(QList<MTR::Book>* list) {
  55. slist->clear();
  56. for(int i = 0;i<list->size();++i) {
  57. slist->append(MTR::SBook(i,list->value(i)));
  58. }
  59. model->setInternalList(*slist);
  60. qcb->setCurrentIndex(0);
  61. qtv->filter();
  62.  
  63. }
To copy to clipboard, switch view to plain text mode 

So my question is simple: what is going on... ?