[Qt-interest] Bug in qhash.cpp, line 324

Pascal Patry iscy at invalidip.com
Fri Jul 3 18:55:33 CEST 2009


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.




More information about the Qt-interest-old mailing list