[Qt-interest] error

Malyushytsky, Alex alex at wai.com
Fri Mar 20 09:34:54 CET 2009


Sir,

Please read your code before posting it.
Try to solve it yourself.
Use debuggers widely when you are learning.
Or to print your code and read it on the paper.
Try to compare the values you get by debugging with one you expecting there.

This is not C++ beginner mailing list. And none of your last 10+ questions I've read had any relations to QT, except that you are using QT to write your code.

As far I can guess about your code posted here you are deleting invalid pointers multiple times:

for(int i=0; i<count; i++)
{
        delete item[count]; // delete item[i];
        delete geometry[count]; // delete geometry[i];
}

If you think that is it, I highly expect the problem in TableWidget::fileNameUpdate.

What do you expect 'geometry' to be there?

QList <Geometry *> geometry;
 or
Geometry *geometry

It looks like  both at the same time.
This is C++ case when colossus collaps becouse of its own power.


Void TableWidget::fileNameUpdate(QString filename, Geometry *geometry)
{
        item[count] = new QTbaleWidgetItem(filename,0);
        filenames.append(filename);
        setItem(count,0,item[count]);

//
        geometry[count] = new Geometry; // ???
        geometry[count] = geometry; ////?????
        count ++;
}

Alex

-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Sujan Dasmahapatra
Sent: Friday, March 20, 2009 12:48 AM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] error

I am writing like this for this error

Error:
*** glibc detected *** double free or corruption (out):
0x0000000000768340 ***

////////////////////////////////////////////////////////////////////////
////////
//In the header file(tablewidget.h)
QList <QTableWidgetIem *> item;
QList <Geometry *> geometry;
QList <QString> filenames;
int count;

////////////////////////////////////////////////////////////////////////
//////////
//In the source file (tablewidget.cpp)
Void TableWidget::~TableWidget()
{
        if(count>0)
        {
                for(int i=0; i<count; i++)
                {
                        delete item[count];
                        delete geometry[count];
                }

                count = 0;
        }

}


Void TableWidget::fileNameUpdate(QString filename, Geometry *geometry)
{
        item[count] = new QTbaleWidgetItem(filename,0);
        filenames.append(filename);
        setItem(count,0,item[count]);
        geometry[count] = new Geometry;
        geometry[count] = geometry;
        count ++;
}
////////////////////////////////////////////////////////////////////////
///////////////////

Can anyone plss tell whats the reason I am getting this error.

Kind Regards,
Sujan Dasmahapatra
-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Arnold Krille
Sent: Friday, March 20, 2009 12:49 PM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] erro

On Friday 20 March 2009 07:55:42 Sujan Dasmahapatra wrote:
> Can U tell me anyone why I am getting this error ?
> *** glibc detected *** double free or corruption (out):
> 0x0000000000768340 ***

Because your system is not truly free???

I mean, come on. Somewhere in your development you played around and
changed some new/delete or malloc/free and these messages started to
show up. Either you still know when that happened and what you played
with or you have to go through the revisions in your version control,
replay them one by one and see when it started.
Then you can check whether you are deleting something twice or you are
deleting something that Qt tries to delete later. Or maybe you create
something with new but delete it with delete[].

But actually your chances of getting concret serious answers would rise
a lot if you gave us more then two lines of text (not counting the 7
lines of your signature)...

Have fun,

Arnold

_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest


---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.

"This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you."

"Please consider our environment before printing this email."




More information about the Qt-interest-old mailing list