PDA

View Full Version : QSpaceritem problem with crashing



moowy
2nd November 2006, 14:19
Hello

I have a problem with a qspaceritem object. The problem is that if I have a QSpacerItem *object inserted into a qgridlayout and I try to close the application it crashes .
I put the qspaceritem inside the layout like this:


QGridLayout *layout = new QGridLayout();
QSpacerItem *spacer = new QSpacerItem(5,2);
layout ->addItem(spacer,0,0);
layout ->addWidget(widget,0,1,1,1);

this is the result
I get a message informing of a first-chance exception.... and the parameter of the code that seems to be the problem:


~QGridBox() { delete item_; }

Do you have any idea how to fix this??

moowy
2nd November 2006, 14:48
I think I've found the answer. Instead of using qspaceritem I'm using dummy widgets and it works perfectly.

jrideout
3rd November 2006, 19:52
What is item_ ? If it is derived from QObject then qt will delete it when its parent is deleted and that might be the source of your problem