Being desperate I decided to check whether the flawless QLabel evokes the problem and now I dare say I was trounced.
Why with two QLabels I receive an error and with one all is ok????
Here you have backtrace at 21:59 LT:
(gdb) backtrace
#0 0xffffe410 in __kernel_vsyscall ()
#1 0xb72c4770 in raise () from /lib/tls/i686/cmov/libc.so.6
#2 0xb72c5ef3 in abort () from /lib/tls/i686/cmov/libc.so.6
#3 0xb72f9d0b in __fsetlocking () from /lib/tls/i686/cmov/libc.so.6
#4 0xb73018bd in mallopt () from /lib/tls/i686/cmov/libc.so.6
#5 0xb7301a44 in free () from /lib/tls/i686/cmov/libc.so.6
#6 0xb75f0e5d in QHashData::freeNode (this=0x8112498, node=0x8124af8)
at tools/qhash.cpp:132
#7 0xb7a4babd in QHash<unsigned long, QWidget*>::remove (this=0x8108d30,
akey=@0x812498c)
at ../../include/QtCore/../../src/corelib/tools/qhash.h:450
#8 0xb7a3ceff in QWidgetPrivate::setWinId (this=0x8124950, id=0)
at kernel/qwidget.cpp:1180
#9 0xb7a72dcc in QWidget::destroy (this=0x81248b8, destroyWindow=true,
destroySubWindows=true) at kernel/qwidget_x11.cpp:782
#10 0xb7a4266c in ~QWidget (this=0x81248b8) at kernel/qwidget.cpp:1162
#11 0xb7c91ef1 in ~QAbstractButton (this=0x81248b8)
at widgets/qabstractbutton.cpp:572
#12 0xb7d3e6e5 in ~QToolButton (this=0x81248b8) at widgets/qtoolbutton.cpp:347
#13 0xb768eea1 in QObjectPrivate::deleteChildren (this=0x8123978)
at kernel/qobject.cpp:1823
#14 0xb7a42649 in ~QWidget (this=0x8123938) at kernel/qwidget.cpp:1158
#15 0xb7d38844 in ~QToolBar (this=0x8123938) at widgets/qtoolbar.cpp:472
---Type <return> to continue, or q <return> to quit---
#16 0xb768eea1 in QObjectPrivate::deleteChildren (this=0x810b300)
at kernel/qobject.cpp:1823
#17 0xb7a42649 in ~QWidget (this=0xbfec0a50) at kernel/qwidget.cpp:1158
#18 0xb7ceac21 in ~QMainWindow (this=0xbfec0a50) at widgets/qmainwindow.cpp:292
#19 0x080527ca in main ()
(gdb) backtrace
#0 0xffffe410 in __kernel_vsyscall ()
#1 0xb72c4770 in raise () from /lib/tls/i686/cmov/libc.so.6
#2 0xb72c5ef3 in abort () from /lib/tls/i686/cmov/libc.so.6
#3 0xb72f9d0b in __fsetlocking () from /lib/tls/i686/cmov/libc.so.6
#4 0xb73018bd in mallopt () from /lib/tls/i686/cmov/libc.so.6
#5 0xb7301a44 in free () from /lib/tls/i686/cmov/libc.so.6
#6 0xb75f0e5d in QHashData::freeNode (this=0x8112498, node=0x8124af8)
at tools/qhash.cpp:132
#7 0xb7a4babd in QHash<unsigned long, QWidget*>::remove (this=0x8108d30,
akey=@0x812498c)
at ../../include/QtCore/../../src/corelib/tools/qhash.h:450
#8 0xb7a3ceff in QWidgetPrivate::setWinId (this=0x8124950, id=0)
at kernel/qwidget.cpp:1180
#9 0xb7a72dcc in QWidget::destroy (this=0x81248b8, destroyWindow=true,
destroySubWindows=true) at kernel/qwidget_x11.cpp:782
#10 0xb7a4266c in ~QWidget (this=0x81248b8) at kernel/qwidget.cpp:1162
#11 0xb7c91ef1 in ~QAbstractButton (this=0x81248b8)
at widgets/qabstractbutton.cpp:572
#12 0xb7d3e6e5 in ~QToolButton (this=0x81248b8) at widgets/qtoolbutton.cpp:347
#13 0xb768eea1 in QObjectPrivate::deleteChildren (this=0x8123978)
at kernel/qobject.cpp:1823
#14 0xb7a42649 in ~QWidget (this=0x8123938) at kernel/qwidget.cpp:1158
#15 0xb7d38844 in ~QToolBar (this=0x8123938) at widgets/qtoolbar.cpp:472
---Type <return> to continue, or q <return> to quit---
#16 0xb768eea1 in QObjectPrivate::deleteChildren (this=0x810b300)
at kernel/qobject.cpp:1823
#17 0xb7a42649 in ~QWidget (this=0xbfec0a50) at kernel/qwidget.cpp:1158
#18 0xb7ceac21 in ~QMainWindow (this=0xbfec0a50) at widgets/qmainwindow.cpp:292
#19 0x080527ca in main ()
To copy to clipboard, switch view to plain text mode
and at 22:00 LT
(gdb) backtrace
#0 0xffffe410 in __kernel_vsyscall ()
#1 0xb71f3770 in raise () from /lib/tls/i686/cmov/libc.so.6
#2 0xb71f4ef3 in abort () from /lib/tls/i686/cmov/libc.so.6
#3 0xb7228d0b in __fsetlocking () from /lib/tls/i686/cmov/libc.so.6
#4 0xb72308bd in mallopt () from /lib/tls/i686/cmov/libc.so.6
#5 0xb7230a44 in free () from /lib/tls/i686/cmov/libc.so.6
#6 0xb751fe5d in QHashData::freeNode (this=0x8112498, node=0x8124af8)
at tools/qhash.cpp:132
#7 0xb797aabd in QHash<unsigned long, QWidget*>::remove (this=0x8108d30,
akey=@0x812498c)
at ../../include/QtCore/../../src/corelib/tools/qhash.h:450
#8 0xb796beff in QWidgetPrivate::setWinId (this=0x8124950, id=0)
at kernel/qwidget.cpp:1180
#9 0xb79a1dcc in QWidget::destroy (this=0x81248b8, destroyWindow=true,
destroySubWindows=true) at kernel/qwidget_x11.cpp:782
#10 0xb797166c in ~QWidget (this=0x81248b8) at kernel/qwidget.cpp:1162
#11 0xb7bc0ef1 in ~QAbstractButton (this=0x81248b8)
at widgets/qabstractbutton.cpp:572
#12 0xb7c6d6e5 in ~QToolButton (this=0x81248b8) at widgets/qtoolbutton.cpp:347
#13 0xb75bdea1 in QObjectPrivate::deleteChildren (this=0x8123978)
at kernel/qobject.cpp:1823
#14 0xb7971649 in ~QWidget (this=0x8123938) at kernel/qwidget.cpp:1158
#15 0xb7c67844 in ~QToolBar (this=0x8123938) at widgets/qtoolbar.cpp:472
---Type <return> to continue, or q <return> to quit---
#16 0xb75bdea1 in QObjectPrivate::deleteChildren (this=0x810b300)
at kernel/qobject.cpp:1823
#17 0xb7971649 in ~QWidget (this=0xbf9e0d70) at kernel/qwidget.cpp:1158
#18 0xb7c19c21 in ~QMainWindow (this=0xbf9e0d70) at widgets/qmainwindow.cpp:292
#19 0x080527ca in main ()
(gdb) backtrace
#0 0xffffe410 in __kernel_vsyscall ()
#1 0xb71f3770 in raise () from /lib/tls/i686/cmov/libc.so.6
#2 0xb71f4ef3 in abort () from /lib/tls/i686/cmov/libc.so.6
#3 0xb7228d0b in __fsetlocking () from /lib/tls/i686/cmov/libc.so.6
#4 0xb72308bd in mallopt () from /lib/tls/i686/cmov/libc.so.6
#5 0xb7230a44 in free () from /lib/tls/i686/cmov/libc.so.6
#6 0xb751fe5d in QHashData::freeNode (this=0x8112498, node=0x8124af8)
at tools/qhash.cpp:132
#7 0xb797aabd in QHash<unsigned long, QWidget*>::remove (this=0x8108d30,
akey=@0x812498c)
at ../../include/QtCore/../../src/corelib/tools/qhash.h:450
#8 0xb796beff in QWidgetPrivate::setWinId (this=0x8124950, id=0)
at kernel/qwidget.cpp:1180
#9 0xb79a1dcc in QWidget::destroy (this=0x81248b8, destroyWindow=true,
destroySubWindows=true) at kernel/qwidget_x11.cpp:782
#10 0xb797166c in ~QWidget (this=0x81248b8) at kernel/qwidget.cpp:1162
#11 0xb7bc0ef1 in ~QAbstractButton (this=0x81248b8)
at widgets/qabstractbutton.cpp:572
#12 0xb7c6d6e5 in ~QToolButton (this=0x81248b8) at widgets/qtoolbutton.cpp:347
#13 0xb75bdea1 in QObjectPrivate::deleteChildren (this=0x8123978)
at kernel/qobject.cpp:1823
#14 0xb7971649 in ~QWidget (this=0x8123938) at kernel/qwidget.cpp:1158
#15 0xb7c67844 in ~QToolBar (this=0x8123938) at widgets/qtoolbar.cpp:472
---Type <return> to continue, or q <return> to quit---
#16 0xb75bdea1 in QObjectPrivate::deleteChildren (this=0x810b300)
at kernel/qobject.cpp:1823
#17 0xb7971649 in ~QWidget (this=0xbf9e0d70) at kernel/qwidget.cpp:1158
#18 0xb7c19c21 in ~QMainWindow (this=0xbf9e0d70) at widgets/qmainwindow.cpp:292
#19 0x080527ca in main ()
To copy to clipboard, switch view to plain text mode
And finally here you have two complete listings...
mymvc.h
#ifndef MTR_SAFETY_DECLARATION_FOR_MYMVC_H
#define MTR_SAFETY_DECLARATION_FOR_MYMVC_H
#include <QWidget>
namespace MTR {
class Book;
class SBook;
}
class myView;
class myModel;
Q_OBJECT
public:
MyMVC
(QList<MTR
::Book>
* list
= 0,
QWidget* parent
= 0);
void prodModel(QList<MTR::Book>*);
public slots:
void setCaseSensitive(bool cs) { caseSensitive = cs; }
signals:
void doubleClickInTreeView(int);
private:
QList<MTR::SBook>* slist;
myModel* model;
myView* qtv;
QLabel* whatTheHell;
//IF COMMENTED, DOES NOT CAUSE ERROR bool caseSensitive;
};
#endif
#ifndef MTR_SAFETY_DECLARATION_FOR_MYMVC_H
#define MTR_SAFETY_DECLARATION_FOR_MYMVC_H
#include <QWidget>
namespace MTR {
class Book;
class SBook;
}
class myView;
class myModel;
class QVBoxLayout;
class QLabel;
class QComboBox;
class QLineEdit;
class MyMVC : public QWidget {
Q_OBJECT
public:
MyMVC(QList<MTR::Book>* list = 0, QWidget* parent = 0);
void prodModel(QList<MTR::Book>*);
public slots:
void setCaseSensitive(bool cs) { caseSensitive = cs; }
signals:
void doubleClickInTreeView(int);
private:
QList<MTR::SBook>* slist;
QLineEdit* le;
QComboBox* qcb;
myModel* model;
myView* qtv;
QVBoxLayout* qvb;
QLabel* label;
QLabel* whatTheHell; //IF COMMENTED, DOES NOT CAUSE ERROR
bool caseSensitive;
};
#endif
To copy to clipboard, switch view to plain text mode
and mymvc.cpp
#include "mymvc.h"
#include "myView.h"
#include "sbook.h"
#include "myModel.h"
#include "myHeaderView.h"
#include <QList>
#include <QVBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QComboBox>
#include <QCheckBox>
MyMVC
::MyMVC(QList<MTR
::Book>
* list,
QWidget* parent
) { slist = new QList<MTR::SBook>();
for(int i = 0;i<list->size();++i) {
slist->append(MTR::SBook(i,list->value(i)));
}
setFixedSize(590,400);
qcb->addItem(tr("filter by Title"));
qcb->addItem(tr("filter by Author"));
qcb->addItem(tr("filter by Publisher"));
qcb->setCurrentIndex(0);
model = new myModel(*slist,le,qcb);
model->filter();
qtv = new myView(model);
qtv->header()->setSortIndicator(0,Qt::DescendingOrder);
label
= new QLabel(tr
("Enter a character string below"));
whatTheHell
= new QLabel(tr
("Damn"));
//IF COMMENTED, DOES NOT CAUSE ERROR caseSensitive = true;
connect(qcb,SIGNAL(currentIndexChanged(int)),le,SLOT(clear()));
connect(qcb,SIGNAL(currentIndexChanged(int)),qtv,SLOT(filter()));
connect(le,
SIGNAL(textChanged
(const QString &)),qtv,
SLOT(filter
()));
connect(model,SIGNAL(fromTVtoVM(int)),this,SIGNAL(doubleClickInTreeView(int)));
qvb->addWidget(label);
qvb->addWidget(le);
qvb->addWidget(whatTheHell); //IF COMMENTED, DOES NOT CAUSE ERROR
qvb->addWidget(qcb);
qvb->addWidget(qtv);
setLayout(qvb);
}
void MyMVC::prodModel(QList<MTR::Book>* list) {
slist->clear();
for(int i = 0;i<list->size();++i) {
slist->append(MTR::SBook(i,list->value(i)));
}
model->setInternalList(*slist);
qcb->setCurrentIndex(0);
qtv->filter();
}
#include "mymvc.h"
#include "myView.h"
#include "sbook.h"
#include "myModel.h"
#include "myHeaderView.h"
#include <QList>
#include <QVBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QComboBox>
#include <QCheckBox>
MyMVC::MyMVC(QList<MTR::Book>* list, QWidget* parent) {
slist = new QList<MTR::SBook>();
for(int i = 0;i<list->size();++i) {
slist->append(MTR::SBook(i,list->value(i)));
}
setFixedSize(590,400);
le = new QLineEdit();
qcb = new QComboBox();
qcb->addItem(tr("filter by Title"));
qcb->addItem(tr("filter by Author"));
qcb->addItem(tr("filter by Publisher"));
qcb->setCurrentIndex(0);
model = new myModel(*slist,le,qcb);
model->filter();
qtv = new myView(model);
qtv->header()->setSortIndicator(0,Qt::DescendingOrder);
label = new QLabel(tr("Enter a character string below"));
whatTheHell = new QLabel(tr("Damn")); //IF COMMENTED, DOES NOT CAUSE ERROR
caseSensitive = true;
qvb = new QVBoxLayout();
connect(qcb,SIGNAL(currentIndexChanged(int)),le,SLOT(clear()));
connect(qcb,SIGNAL(currentIndexChanged(int)),qtv,SLOT(filter()));
connect(le,SIGNAL(textChanged(const QString &)),qtv,SLOT(filter()));
connect(model,SIGNAL(fromTVtoVM(int)),this,SIGNAL(doubleClickInTreeView(int)));
qvb->addWidget(label);
qvb->addWidget(le);
qvb->addWidget(whatTheHell); //IF COMMENTED, DOES NOT CAUSE ERROR
qvb->addWidget(qcb);
qvb->addWidget(qtv);
setLayout(qvb);
}
void MyMVC::prodModel(QList<MTR::Book>* list) {
slist->clear();
for(int i = 0;i<list->size();++i) {
slist->append(MTR::SBook(i,list->value(i)));
}
model->setInternalList(*slist);
qcb->setCurrentIndex(0);
qtv->filter();
}
To copy to clipboard, switch view to plain text mode
Bookmarks