[Qt-interest] Crash in QAbstractTableModel.beginRemoveRows

Niklaus Hersche niklaus.hersche at gesys.ch
Fri Dec 10 10:44:29 CET 2010


Hi

I have implemented an Model/View, where the Model runs in it's on thread.
With a sample interval of 500ms it collects data an writes to a ring buffer
stored in a file.
After inserting a new record to the full ring buffer I call:

beginInsertRows ( QModelIndex(), m_Index.lineCount(), m_Index.lineCount());
endInsertRows();
beginRemoveRows ( QModelIndex(), 0, 0);
endRemoveRows();

This is not very elegant, but I to now a better(:
Any better solution?

The application, after while, crashes in:
QtCored4.dll!QHashData::nextNode(QHashData::Node * node=0x00fa8b70)
QtCored4.dll!QHash<QModelIndex,QPersistentModelIndexData
*>::const_iterator::operator++()
QtCored4.dll!QAbstractItemModelPrivate::rowsAboutToBeRemoved(const
QModelIndex & parent={...}, int first=0, int last=0)
QtCored4.dll!QAbstractItemModel::beginRemoveRows(const QModelIndex &
parent={...}, int first=0, int last=0)

The node data is corrupt!

The thread has its own event loop. I use a timer for the sample interval.
DataLogThread()
	: m_enabled( false)
	, m_SampleIntervalMs( 0)
	, m_SampleTimerId( 0)
{
	moveToThread( this);
}


What could be the reason for the crash? Is it threading problem?

Thank you
Nik




More information about the Qt-interest-old mailing list