PDA

View Full Version : itemChange() glibc invalid pointer



dreamer
3rd May 2008, 08:52
I reimplement the itemChange funciton in my custo QGraphicsItem.



QVariant rectItem::itemChange(QGraphicsItem::GraphicsItemCh ange change, const QVariant &value){
std::cout<<"item "<<type()<<" change"<<std::endl;

QGraphicsRectItem::itemChange(change,value);
}


When i execute the program, i get this error after I insert an item in my scene........
"*** glibc detected *** ./qt_program: free(): invalid pointer: 0xbfa28b50 ***"

What's wrong with the implementation? Without the ridefinition of this function, the program works well..........


GDB gives me this error:
"Program received signal SIGSEGV, Segmentation fault.
0xb7e52ab6 in ?? () from /usr/lib/libQtGui.so.4"

aamer4yu
3rd May 2008, 09:02
I guess line 4 should be -


return QGraphicsItem::itemChange(change,value);

hope am right :)

dreamer
3rd May 2008, 09:04
yes, you are right.........:D