qq_32107733 2017-03-06 08:19 采纳率: 0%
浏览 2599

在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;
}

  • 写回答

1条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 MATLAB动图问题
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名