View Full Version : Strange CRASH error when press down or up into a cell of TableView and more...

10th May 2011, 12:59
I have I custom tableview conected with a custom tablemodel.
No I have only doubleclick as editortrigger.
I have no delegates.
The table works fine.

In release mode, I do doubleclick, write 'asasas' and when press 'down' or 'up' program crash (I have time to view that tablemodel::setData is called with success).
Ok I go to debug mode and it does not happen, but I discover that if I write 'as' very fast I have a crash. (I press the keys when the cell is selected but not in edit mode)

Ok, I clean the project (staying at debug mode, I clean the debug files?) , run the project and the debug mode behave exactly as release mode (crash on edit and 'down' or 'up'¡ key, but works if I write 'as' very fast). I go to 'release' mode and it behaves as old debug mode (that is to say, can press down or up when editing but crash when write 'as' very fast).

It is a madness ....

Any idea ?

( Maybe I have to learn how to debug this ? I have mingw)

(When I press down or up when editing, the value is set to the cell and the next-previous is selected, as user expect) .

(I cannot leave the code because it is a big project with a lot of dependencies).

Santosh Reddy
10th May 2011, 18:16
Looks to me as there is some problem in your model implementation.
here's a tip to check: all the Model-View Interface Implmentations should check for index.isValid() condition and handle it accordingly (i mean safely), I had similar crash problem due to this, but was easy to catch using QtCreator Debugger

12th May 2011, 08:10
Thanks Santosh.
Uff, i dont understand the debugger (i have mingw). Any help to use when crash ? (now it stops almost at any point ..... It rises every time I have and lost the focus on the cell, so I am unable to detect the fail ....).
Thanks again.

Santosh Reddy
12th May 2011, 17:45
Ok, here is tip to use the QtCreator Debugger (if you are using it)

Build in Debug Mode, then Start Debug (Press F5), don;t use Run(Ctrl+R), you cannot look at the stack if use Run even if Debug Mode, you need use Debug(F5), then when your application crashes, have look at the stack and see where it stopped, usually it would crash in some library functions, then trace back to your implemented function, it is generally here where you pass an invalid parameter to library, which may enentually lead to a crash.

Good Luck...