在我的项目中,我有很多循环进行许多计算,这可能需要相当长的时间。一切都运行良好,直到我在加载时出错。当它计算所有内容时,我的程序在完成加载之前变得“无响应”。似乎有某种计时器,当它达到 60 秒时,调试停止,我收到此错误:
Exception at 0x7585b9bc, code: 0xe06d7363: C++ exception, flags=0x1 (execution cannot be continued) (first chance) in Qt5Cored!QTimer::isSingleShot
有什么方法可以禁用该响应计时器?
谢谢你的时间 :)
编辑:这是循环。它非常抽象,所以我很抱歉你不知道这个循环的完整上下文。:/ 但是知道这一点,程序不会在完全相同的时间点冻结。有时当 i== 498 时,有时是 499 等等。
for(int i=0; i<=728; i++)
{
int sections;
if(PCBRchunks[i] != "Null")
{
QString blockId;
PCBRblocks[i].fill('0', 131072);
//Get number of sections
temp_hex = PCBRchunks[i].mid(PCBRchunks[i].indexOf("09000853656374696f6e73")+30, 2);
HexToInt2(temp_hex, temp_int);
sections = temp_int;
int totalStart;
totalStart = PCBRchunks[i].indexOf("070006426c6f636b7300001000")+26;
for(int s=0; s<=sections-1; s++)
{
int y;
temp_hex = PCBRchunks[i].mid(totalStart + (s*20604) + 20574, 2);
HexToInt2(temp_hex, y);
for(int k=0; k<=255; k++)
{
for(int p=0; p<=15; p++)
{
blockId = PCBRchunks[i].mid(totalStart + (s*20604) + (p*512) + ((((k-((k/16)*16))*16)+(k/16))*2), 2);
if(y<8)
PCBRblocks[i].replace((p*2)+(k*256)+(y*32), 2, blockId);
else
PCBRblocks[i].replace((p*2)+(k*256)+((y-8)*32)+65536, 2, blockId);
}
}
}
}
if(PCBLchunks[i] != "Null")
{
QString blockId;
PCBLblocks[i].fill('0', 131072);
//Get number of sections
temp_hex = PCBLchunks[i].mid(PCBLchunks[i].indexOf("09000853656374696f6e73")+30, 2);
HexToInt2(temp_hex, temp_int);
sections = temp_int;
int totalStart;
totalStart = PCBLchunks[i].indexOf("070006426c6f636b7300001000")+26;
for(int s=0; s<=sections-1; s++)
{
int y;
temp_hex = PCBLchunks[i].mid(totalStart + (s*20604) + 20574, 2);
HexToInt2(temp_hex, y);
for(int k=0; k<=255; k++)
{
for(int p=0; p<=15; p++)
{
blockId = PCBLchunks[i].mid(totalStart + (s*20604) + (p*512) + ((((k-((k/16)*16))*16)+(k/16))*2), 2);
if(y<8)
PCBLblocks[i].replace((p*2)+(k*256)+(y*32), 2, blockId);
else
PCBLblocks[i].replace((p*2)+(k*256)+((y-8)*32)+65536, 2, blockId);
}
}
}
}
if(PCTRchunks[i] != "Null")
{
QString blockId;
PCTRblocks[i].fill('0', 131072);
//Get number of sections
temp_hex = PCTRchunks[i].mid(PCTRchunks[i].indexOf("09000853656374696f6e73")+30, 2);
HexToInt2(temp_hex, temp_int);
sections = temp_int;
int totalStart;
totalStart = PCTRchunks[i].indexOf("070006426c6f636b7300001000")+26;
for(int s=0; s<=sections-1; s++)
{
int y;
temp_hex = PCTRchunks[i].mid(totalStart + (s*20604) + 20574, 2);
HexToInt2(temp_hex, y);
for(int k=0; k<=255; k++)
{
for(int p=0; p<=15; p++)
{
blockId = PCTRchunks[i].mid(totalStart + (s*20604) + (p*512) + ((((k-((k/16)*16))*16)+(k/16))*2), 2);
if(y<8)
PCTRblocks[i].replace((p*2)+(k*256)+(y*32), 2, blockId);
else
PCTRblocks[i].replace((p*2)+(k*256)+((y-8)*32)+65536, 2, blockId);
}
}
}
}
if(PCTLchunks[i] != "Null")
{
QString blockId;
PCTLblocks[i].fill('0', 131072);
//Get number of sections
temp_hex = PCTLchunks[i].mid(PCTLchunks[i].indexOf("09000853656374696f6e73")+30, 2);
HexToInt2(temp_hex, temp_int);
sections = temp_int;
int totalStart;
totalStart = PCTLchunks[i].indexOf("070006426c6f636b7300001000")+26;
for(int s=0; s<=sections-1; s++)
{
int y;
temp_hex = PCTLchunks[i].mid(totalStart + (s*20604) + 20574, 2);
HexToInt2(temp_hex, y);
for(int k=0; k<=255; k++)
{
for(int p=0; p<=15; p++)
{
blockId = PCTLchunks[i].mid(totalStart + (s*20604) + (p*512) + ((((k-((k/16)*16))*16)+(k/16))*2), 2);
if(y<8)
PCTLblocks[i].replace((p*2)+(k*256)+(y*32), 2, blockId);
else
PCTLblocks[i].replace((p*2)+(k*256)+((y-8)*32)+65536, 2, blockId);
}
}
}
}
qDebug() << i;
ui->progressBar->setValue((i*100)/729);
}