Running code below I got another crash but now for QList:
#define X86_PAGE_SIZE 4096
class MemChunk
{
char m_aChars[0x100 * X86_PAGE_SIZE];
public:
MemChunk() { qMemSet(&m_aChars, 0, sizeof(m_aChars)); }
};
void testQtList(void)
{
QList<MemChunk> list;
MemChunk memChunk;
while (true)
{
int before = list.size();
try
{
list.append(memChunk);
}
catch(...)
{
qDebug() << "Exception";
break;
}
if (before == list.size())
{
qDebug() << "Break";
break;
}
}
}
#define X86_PAGE_SIZE 4096
class MemChunk
{
char m_aChars[0x100 * X86_PAGE_SIZE];
public:
MemChunk() { qMemSet(&m_aChars, 0, sizeof(m_aChars)); }
};
void testQtList(void)
{
QList<MemChunk> list;
MemChunk memChunk;
while (true)
{
int before = list.size();
try
{
list.append(memChunk);
}
catch(...)
{
qDebug() << "Exception";
break;
}
if (before == list.size())
{
qDebug() << "Break";
break;
}
}
}
To copy to clipboard, switch view to plain text mode
(gdb) r
Starting program: D:\Work\TestQt/debug\testQt.exe
Program received signal SIGSEGV, Segmentation fault.
0x004077c3 in probe ()
Current language: auto; currently c++
(gdb) bt
#0 0x004077c3 in probe ()
#1 0x1018f090 in QListData::shared_null () at painting/qdrawhelper.cpp:2227
#2 0x0040162f in testQtList() () at testQt.cpp:39
#3 0x0040145b in qMain(int, char**) (argc=1, argv=0x3d4c78) at testQt.cpp:11
#4 0x00401edf in WinMain (instance=0x400000, prevInstance=0x0, cmdShow=10)
at qtmain_win.cpp:120
#5 0x0040197a in main ()
(gdb)
Now it happens append method of QList.
My question now: Is Qt library able to handle memory allocation failures gracefully at all?
Bookmarks