PDA

View Full Version : Memory leak in QRegExpValidator?!?



Tiansen
28th December 2009, 14:03
Ok, I have a problem that is driving me crazy and I cannot find a way to fix it. In my header I have these declarations:


QRegExpValidator* validatorFloat;
QRegExpValidator* validatorCenaNaEnoto;
QRegExpValidator* validatorZadnjiZnakSifre;

In source file I have this code:


validatorZadnjiZnakSifre=new QRegExpValidator(this);
validatorZadnjiZnakSifre->setRegExp(QRegExp("[0-9A-Za-z]"));
ui->ZadnjiZnakSifreEdit->setValidator(validatorZadnjiZnakSifre);
validatorCenaNaEnoto=new QRegExpValidator(this);
validatorCenaNaEnoto->setRegExp(QRegExp("[0-9]{1,6}[.,]{0,1}[0-9]{0,2}"));
ui->CenaNaEnotoEdit->setValidator(validatorCenaNaEnoto);
validatorFloat=new QRegExpValidator(this);
validatorFloat->setRegExp(QRegExp("[0-9]{1,10}[.,]{0,1}[0-9]{0,6}"));
ui->FaktorPretvorbeEnotEdit->setValidator(validatorFloat);
ui->KolicinaEdit->setValidator(validatorFloat);

When exiting program I get this message in debugger:


Heap block at 095C6DE0 modified at 095C6E24 past requested size of 3c


When I comment out above mentioned lines in source file, then I dont get these message. How can I solve this problem? I tried all approaches that I can think of, but nothing helps. Is there a memory leak in Qt 4.6?

high_flyer
28th December 2009, 14:17
start by commenting one variable (and its use) at a time from the whole section.
This way you will locate the variable which causes the problem.
Then, we can look further.