[Qt-interest] Bug in qhash.cpp, line 324
Eric Clark
eclark at ara.com
Fri Jul 3 19:36:45 CEST 2009
Thank you Pascal! I have been programming in c++ for over 10 years and never knew that it was valid to delete a null pointer. Guess you really do learn something new every day. I am going to report the bug to the developer of nedmalloc. Again, thank you for your reply, especially before I posted it to the Qt bugs!
Eric
-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Pascal Patry
Sent: Friday, July 03, 2009 11:56 AM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] Bug in qhash.cpp, line 324
On Friday 03 July 2009 12:19:20 Eric Clark wrote:
> Hello All,
>
> Sorry to post this to this message board, but I am unfamiliar with how to
> post bugs to Qt. Maybe someone can help me out with that? I think that I
> have found a bug in Qt. I am trying to compile nedmalloc into Qt, and moc
> keeps crashing on the same line in qhash.cpp. The line number is 324 and
> the code is:
>
> delete [] oldBuckets;
>
> The code looks fine, but when I enter the debugger, oldBuckets is a null
> pointer. I am pretty sure that it is not good practice to try and delete a
> null pointer. Maybe someone has some insight into this? If I add a check in
> nedfree for a null pointer, it all works fine, but I should not have to add
> this check.
These are all valid:
free(0);
delete 0;
delete[] 0;
So, there are no bugs in Qt. It's most likely the allocator that you are using
that is not checking for nullity.
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list