[Qt-interest] Static destructors errors
marc at mferland.net
marc at mferland.net
Fri Oct 16 16:55:42 CEST 2009
Quoting "Colin S. Miller" <no-spam-thank-you at csmiller.demon.co.uk>:
> marc at mferland.net wrote:
>
>> Hi all,
>>
>> I've posted about this problem a while ago but didn't have the time to
>> correctly answer the questions/requests that was asked to me (sorry
>> about that!). So here I go again.
>>
>> I'm currently working on a large project involving Qt 4.5.2 and we have
>> a really strange problem when closing the application. More precisely,
>> the application crashes 50% of the time in different static destructors.
>> See the following stack traces for more information:
>>
> <snip!>
>
> Marc,
> Do either of the destructors use data in the other class?
>
> Colin S. Miller
Hi Colin,
I don't think so... These are internally (private) used containers so
I don't really how they are used. Your thinking that maybe one is
destroyed before the other?
On my side, I've checked if our problematic static containers where
indeed empty _before_ closing the application and it doesn't really
change anything whether they are empty or not.
One detail I forgot to mention in my last post is that in the
timerDestructor case, the problem is caused by a corrupted iterator
inside a for-loop. I've traced the loop in a debugger and for some
reason, calling a delete changes the value of the iterator... malloc
bug? (would be really surprising IMHO).
The for loop looks like this (from qabstracteventdispatcher.cpp:70):
static void timerIdsDestructorFunction()
{
// start at one, the first bucket is pre-allocated
for (int i = 1; i < NumberOfBuckets; ++i)
delete [] static_cast<int *>(timerIds[i]);
}
Regards,
Marc
More information about the Qt-interest-old
mailing list