I've been trying to work around this runtime mayhem for past 24 with no avail.
I'm a beginner, and have no knowledge about the inbuilt debugger in Qt4. I've tried to run the program sans the Qt GUI, and it works fine.
I've narrowed down the OOM killer to a function getWildCards(word); But I'm not sure what wrong I'm doing in there and moreover I'm not using QList anywhere in the entire program to get that error.
Qt exits the program with a "Microsoft Visual C++ Runtime Error" and a code 3.
Here's the code snippet.
void MainWindow::spellCheck() { //a private slot
QByteArray qB
= ui
->lineEditWord
->text
().
toLatin1();
char* word = (char *) qB.data(); //casts QByteArray to char*
ui->txtEditMain->insertPlainText(" ");
ui->txtEditMain->insertPlainText(ui->lineEditWord->text());
ui
->txtEditSpell
->setText
(QString::null);
WDict->spellcheck(word,2); //calls a spellchecker, WDict is a private *member
for(int i=0; i<WDict->sw.ubound; i++) { //WDict->sw.ubound is upper bound for the iteration
if(string.isEmpty()!=true)
ui->txtEditSpell->append(string);
string.clear();
}
ui
->lblSpell
->setText
(QString::number(WDict
->sw.
ubound).
append(" Spellings"));
ui
->txtEditWild
->setText
(QString::null);
ui
->lineEditWord
->setText
(QString::null);
getWildcards(word); //<--------the problem occurs when this function is called
}
void MainWindow::getWildcards(char* word) { //the problematic function!
WDict->trie_wildcard_print(word); //calls a function which works perfectly fine
for(int i=0; i<WDict->sw.ubound; i++) { //on an average ubound is about 300
string2.toLower();
ui->txtEditWild->append(string2);
string2.clear();
}
ui
->lblWild
->setText
(QString::number(WDict
->sw.
ubound).
append(" Wild Cards"));
}
void MainWindow::spellCheck() { //a private slot
QByteArray qB = ui->lineEditWord->text().toLatin1();
char* word = (char *) qB.data(); //casts QByteArray to char*
QString string;
ui->txtEditMain->insertPlainText(" ");
ui->txtEditMain->insertPlainText(ui->lineEditWord->text());
ui->txtEditSpell->setText(QString::null);
WDict->spellcheck(word,2); //calls a spellchecker, WDict is a private *member
for(int i=0; i<WDict->sw.ubound; i++) { //WDict->sw.ubound is upper bound for the iteration
string = (QString(QLatin1String(WDict->sw.valid_words[i])).toLower());
if(string.isEmpty()!=true)
ui->txtEditSpell->append(string);
string.clear();
}
ui->lblSpell->setText(QString::number(WDict->sw.ubound).append(" Spellings"));
ui->txtEditWild->setText(QString::null);
ui->lineEditWord->setText(QString::null);
getWildcards(word); //<--------the problem occurs when this function is called
}
void MainWindow::getWildcards(char* word) { //the problematic function!
QString string2;
WDict->trie_wildcard_print(word); //calls a function which works perfectly fine
for(int i=0; i<WDict->sw.ubound; i++) { //on an average ubound is about 300
string2 = QString(QLatin1String(WDict->sw.valid_words[i])); //valid_words is 600long and 64wide
string2.toLower();
ui->txtEditWild->append(string2);
string2.clear();
}
ui->lblWild->setText(QString::number(WDict->sw.ubound).append(" Wild Cards"));
}
To copy to clipboard, switch view to plain text mode
Merci en avance.
Bookmarks