[Qt-interest] QLineEdit::clear() crash
Francisco Gonzalez
gzmorell at gmail.com
Mon Jul 18 22:40:59 CEST 2011
Hi,
> void le1_changed(const QStrig& v) {
> le2->clear(); // CRASH HERE
> le2->setEnabled(validate_le1());
> }
>
> The crash happens somewhere inside the clear() call marked with "CRASH
> HERE" above. However, it only happens after the first QLineEdit widget
> has already had text put into it and then one of the QComboBox widgets
> before it is changed.
> Any ideas?
Check if le2 is a valid pointer.
You can use QPointer for this:
QPointer<QLineEdit> le2 = new QLineEdit(parent);
...
if (le2)
le2->clear();
else
qDebug() << "Some text";
Hope this will help,
Francisco
More information about the Qt-interest-old
mailing list