发送信号中内存非法访问
/////////////////////////////////////////////////////////////常量定义#define STR_TOTALLINE_TYPE_USER QString::fromUtf8("内线")#define STR_TOTALLINE_TYPE_TRUNK QString::fromUtf8("外线")#define STR_TOTALLINE_TYPE_EMPTY QString::fromUtf8("悬空")#define STR_TOTALLINE_TYPE_RECORD QString::fromUtf8("录音")/////////////////////////////////////////////////////////////signal 定义signals: void outTableItem(int nRow, int nCol, QString label);//////////////////////////////////////////////////////////////signal 使用 long lType; QString strText;/*usTotalLine > 8*/ for (int i = 0; i < usTotalLine; i++) { lType = CheckChTypeNew(i); switch (lType) { case CHTYPE_USER: strText = STR_TOTALLINE_TYPE_USER; break; case CHTYPE_TRUNK: strText = STR_TOTALLINE_TYPE_TRUNK; break; case CHTYPE_EMPTY: strText = STR_TOTALLINE_TYPE_EMPTY; break; case CHTYPE_RECORD: strText = STR_TOTALLINE_TYPE_RECORD; break; }/*我注释一种的任何一句emit 程序做一次循环就出现内存的非法访问*//*如果不注释 程序可以做3次循环*//*debug 发现是QString一起的错误*/ emit outTableItem(i, INT_TOTALLINE_ITEM_NUM, QString::number(i)); emit outTableItem(i, INT_TOTALLINE_ITEM_TYPE, strText); msleep(500); }///////////////////////////////////////////////////////////////////slot 定义public slots: void startServer(bool checked);///////////////////////////////////////////////////////////////////connect connect(&classVoiceSystem, SIGNAL(outTableItem(int, int, QString)), this, SLOT(setTableItem(int, int, QString)));///////////////////////////////////////////////////////////////////slot 我屏蔽主体语句错误依然 可以排除slot中的问题void CallCenterServer::setTableItem(int nRow, int nCol, QString label) { QTableWidgetItem *item = new QTableWidgetItem(label); ui.tableWidget->setItem(nRow, nCol, item);}