在Qt Creator中循环一次可以正常运行,循环两次时就崩溃了,是什么原因?该怎么办

Error - RtlWerpReportException failed with status code :-1073741823. Will try to launch the process directly
程序异常结束。
D:\chengxu2\build-StationEditer-Desktop_Qt_4_8_5-Debug\debug\StationEditer.exe 退出,退出代码: -1073741819

代码:
void Station::produceRouteSheet()
{
QList::const_iterator _iter=d->m_deviceList.begin();
while(_iter!=d->m_deviceList.end())
{
if((*_iter)->type()==DeviceType_TrainControl)
{
controlButton.append((*_iter));
}
_iter++;
}
QList::const_iterator iter=controlButton.begin();
while(iter!=controlButton.end())
{
DeviceAbstract *connectDevice=(*iter)->next();
int trackNum=0;
while(trackNum!=2)
//while(connectDevice->type()!=DeviceType_TrainControl)
{
DeviceAbstract *f=forward(connectDevice);
if(trackNum!=0)
{
int i=0;
while(routeSheet[trackNum-1][i]!=0&&routeSheet[trackNum-1][i]!=connectDevice->last()->next()->id())
{
routeSheet[trackNum][i]=routeSheet[trackNum-1][i];
i++;
}
int k=0;
while(passageway[k]!=0)
{
routeSheet[trackNum][i++]=passageway[k];
k++;
}
}else{
routeSheet[0][0]=(*iter)->id();
int t=0;
while(passageway[t]!=0)
{
routeSheet[0][t+1]=passageway[t];
t++;
}
}
connectDevice=back(f,(*iter))->other();
//int l=0;
//while(passageway[l]!=0)
//{
//qDebug()< //l++;
//}
//qDebug()id();
trackNum++;
}
int p=0,q=0;
while(p {
q=0;
while(q {
qDebug() q++;
}
p++;
}
iter++;
delete connectDevice;
}
}
DeviceAbstract *Station::forward(DeviceAbstract *startFork)
{
for(int i=0;i {
passageway[i]=0;
}
DeviceAbstract *lastDevice=startFork;
int j=0;
while(lastDevice->type()!=DeviceType_Track)
{
passageway[j]=lastDevice->id();
if(lastDevice->type()==DeviceType_Fork)
{
if((lastDevice->deviceGUIAbstract()->nextPos().x())<(lastDevice->deviceGUIAbstract()->lastPos().x()))
{
if(lastDevice->last()!=NULL)
{
lastDevice=lastDevice->last();
j++;
}else{
qDebug()<<"连接中断于"<id();
break;
}
}else{
if(lastDevice->next()!=NULL)
{

                lastDevice=lastDevice->next();
                j++;
                break;
            }else{
                qDebug()<<"连接中断于正位:"<<lastDevice->id();
                break;
            }
        }
    }else{
        if(lastDevice->next()!=NULL)
        {
            lastDevice=lastDevice->next();
            j++;
            break;
        }else{
            qDebug()<<"连接中断于:"<<lastDevice->id();
            break;
        }
    }
}
passageway[j]=lastDevice->id();
return lastDevice;

}
DeviceAbstract *Station::back(DeviceAbstract *startTrack,DeviceAbstract *control)
{
DeviceAbstract *nextDevice=startTrack;
DeviceAbstract *judge=startTrack->next();
DeviceAbstract *result=NULL;
//bool isFind=false;
while(true)
{
if(nextDevice->type()==DeviceType_Fork)
{
if(nextDevice->deviceGUIAbstract()->nextPos().x()deviceGUIAbstract()->lastPos().x())
{
//DeviceAbstract *deviceNext=nextDevice->next();
//while(deviceNext->type()!=DeviceType_TrainControl)
//{
//deviceNext=back(deviceNext,control);
//}
//if(deviceNext!=control)
//{
//DeviceAbstract *deviceOther=nextDevice->other();
//while(deviceOther->type()!=DeviceType_TrainControl)
//{
//deviceOther=back(deviceOther,control);
//}
//nextDevice=nextDevice->other();
//}else{
//nextDevice=nextDevice->next();
//}
}else{
if(nextDevice->next()==judge)
{
result=nextDevice;
break;
//isFind=true;
//return nextDevice;
}else{
judge=nextDevice;
nextDevice=nextDevice->last();
}
}
}else{
if(nextDevice->last()!=NULL)
{
judge=nextDevice;
nextDevice=nextDevice->last();
}else{
result=nextDevice;
break;
//return nextDevice;
//isFind=true;
}
}
}
return result;
}

qt
0

1个回答

0
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!