1
我正在使用QTextBrowser通過追加函數顯示字符串。Qt在QVector中拋出ASSERT失敗<T> :: operator []:QTextBrowser中的「索引超出範圍」
void testing::displaytext()
{
qRegisterMetaType<QTextCursor>("QTextCursor");
ui.textBrowser->append("Welcome to the world of QT");
ui.textBrowser->append("Welcome to the world of QT");
ui.textBrowser->append("Welcome to the world of QT");
ui.textBrowser->append("Welcome to the world of QT");
ui.textBrowser->append("Welcome to the world of QT");
ui.textBrowser->append("Welcome to the world of QT");
ui.textBrowser->append("Welcome to the world of QT");
ui.textBrowser->append("Welcome to the world of QT");
ui.textBrowser->append("Welcome to the world of QT");
}
上述功能正在通過定期線程調用,但 後被要求有時它拋出這個錯誤:
ASSERT failure in QVector<T>::operator[]: "index out of range", file c:\iwmake\build_vs2010_opensource_________________padding_________________\include\qtcore\../../src/corelib/tools/qvector.h
我怎樣才能解決這個例外?
它是否被多個線程調用? – cmannett85
不,只有一個線程。 – learner
我應該更一般:它是由任何其他線程寫入或讀取? – cmannett85