Hi All!
This sounds pretty basic stuff but I'm having problem with QVector.
I'm using Qt 4.5.2
The code is below.
in header:
QVector<QWidget*> *m_activeWidgets;
QVector<QWidget*> *m_activeWidgets;
To copy to clipboard, switch view to plain text mode
in cpp:
this->m_activeWidgets->append( widget );
QWidget* widget = new QWidget();
this->m_activeWidgets->append( widget );
To copy to clipboard, switch view to plain text mode
result:
It crashes on append method.
in qvector.h
paste:
void QVector<T>::append(const T &t)
{
if (d->ref != 1 || d->size + 1 > d->alloc) { <--- at here *******************
const T copy(t);
realloc(d->size, QVectorData::grow(sizeOfTypedData(), d->size + 1, sizeof(T),
QTypeInfo<T>::isStatic));
if (QTypeInfo<T>::isComplex)
new (d->array + d->size) T(copy);
else
d->array[d->size] = copy;
} else {
if (QTypeInfo<T>::isComplex)
new (d->array + d->size) T(t);
else
d->array[d->size] = t;
}
++d->size;
}
void QVector<T>::append(const T &t)
{
if (d->ref != 1 || d->size + 1 > d->alloc) { <--- at here *******************
const T copy(t);
realloc(d->size, QVectorData::grow(sizeOfTypedData(), d->size + 1, sizeof(T),
QTypeInfo<T>::isStatic));
if (QTypeInfo<T>::isComplex)
new (d->array + d->size) T(copy);
else
d->array[d->size] = copy;
} else {
if (QTypeInfo<T>::isComplex)
new (d->array + d->size) T(t);
else
d->array[d->size] = t;
}
++d->size;
}
To copy to clipboard, switch view to plain text mode
paste:qbasicatomic.h
inline bool operator!=(int value) const
{
return _q_value != value; <-- crash *******************
}
inline bool operator!=(int value) const
{
return _q_value != value; <-- crash *******************
}
To copy to clipboard, switch view to plain text mode
I don't know is it any help but it seems like _q_value doesn't have any value in debugger.
Any ideas?
- Vectori
Bookmarks