I found the crash when I used QVector. Actually it raises a question how to handle memory allocation failures gracefully with Qt container classes like QVector and etc.
The code below demonstrates problem. To compile and run it I used Qt 4.3.2 and GCC/G++ 3.4.2 on Windows Server 2003. The STL version of vector correctly raises exception but QVector just generates segmentation fault.
try
{
std::vector<qlonglong>* pVector =
new std::vector<qlonglong>(INT_MAX - 0x1000);
}
catch(...)
{
}
try
{
QVector<qlonglong>* pQVector =
new QVector<qlonglong>(INT_MAX - 0x1000);
}
catch(...)
{
}
Can somebody shed light on this topic.
Bookmarks