PDA

View Full Version : QModelIndex destructor causes "user breakpoint"



Arthur
14th March 2006, 07:53
Hello,

I am developing a class using a QTableWidget and, although I re-installed Qt 4.1.1 and rebuilt my project several times to avoid inconsistent build problems, I get a "user breakpoint", when the QModelIndex destructor is invoked in the following method:



void MyClass::foo()
{
QList<QModelIndex> indexes = pAEditor_->tableWidget->selectionModel()->selectedIndexes();
pAEditor_->btnOne->setDisabled( indexes.count() <= 0 );
pAEditor_->btnTwo->setDisabled( indexes.count() <= 0 );
}


The user breakpoint occurs on the following code in qatomic.h:



inline int q_atomic_test_and_set_release_int(volatile int *ptr, int expected, int newval)
{
return q_atomic_test_and_set_int(ptr, expected, newval);
}


This is the call stack:

ntdll.dll!7c901230()
ntdll.dll!7c96c943()
ntdll.dll!7c96cd80()
ntdll.dll!7c960af8()
> QtCored4.dll!q_atomic_test_and_set_release_int(vol atile int * ptr=0x02cd0000, int expected=1073741920, int newval=85780576) Line 199 + 0x11 C++
kernel32.dll!7c85e7af()
Database.dll!_CrtIsValidHeapPointer(const void * pUserData=0x051ce880) Line 1807 C
Database.dll!_free_dbg_lk(void * pUserData=0x051ce880, int nBlockUse=1) Line 1132 + 0x9 C
Database.dll!_free_dbg(void * pUserData=0x051ce880, int nBlockUse=1) Line 1070 + 0xd C
Database.dll!operator delete(void * pUserData=0x051ce880) Line 54 + 0x10 C++
Database.dll!QModelIndex::`scalar deleting destructor'() + 0x46 C++
Database.dll!QList<QModelIndex>::node_destruct(QList<QModelIndex>::Node * from=0x051ce834, QList<QModelIndex>::Node * to=0x051ce834) Line 330 + 0x3e C++
Database.dll!QList<QModelIndex>::free(QListData::Data * data=0x051ce820) Line 528 C++
Database.dll!QList<QModelIndex>::~QList<QModelIndex>() Line 502 C++
Database.dll!MyClass::Foo() Line 381 + 0xf C++



Now, I know this is all a little vague, but does someone have any suggestions on how to solve this?

Tnx,
Arthur

wysota
21st March 2006, 14:00
Are you using an IDE to build your application? It looks more like you set a breakpoint somewhere in the IDE than a problem with the application code. Try using commandline tools to build and execute your application and see if the problem persists.

Arthur
30th March 2006, 09:11
I use VC++ 2003, the problem was the fact that (for some reason) my runtime libraries were not set to multithreaded DLL.

I didn't set any breakpoints, this user breakpoint is caused by Qt runtime checks in the VC++ debugger (done on purpose when there are heap memory problems I guess).

Thanks anyway.