PDA

View Full Version : Crash in QTableWidget



ghorwin
29th October 2007, 05:27
Hi there,

there seems to be a bug in the QTableWidget that causes a crash/access violation and can be reproduced as follows:

- start editing a row in a QTableWidget
- before leaving the editor, start a function that accesses the content of the table widget using the item() member function

The crash occurred when editing a QTableWidget and saving (the save operation reads the data from the QTableWidget by retrieving QTableWidgetItems via the item() member function) while in the in-place editor was still active.

A workaround is to first place the focus on a different widget to finish the editor and than start reading the content of the table widget.

Is this a known bug?

Bye,
Andreas

wysota
29th October 2007, 09:32
Could we see a minimal compilable example reproducing the problem?

jacek
29th October 2007, 14:03
Does this crash always occur or only when you edit an empty cell?

ghorwin
29th October 2007, 17:57
No, the crash always occurred when the editor was still active. But the good news is - while I was writing a demo program to reproduce the bug, I updated to Qt 4.3.2 and - surprise surprise - the crash no longer occurs (in 4.3.1 it still did)!

So, that also answers my question whether this bug is already known :-)

However, there is still a minor problem. Take a look at the attached test program that I wrote to illustrate what I was talking about.

In Qt 4.3.1 using the save button works (because the focus is moved), using the ShortCut CTRL+S while editing causes a crash.

Now, in Qt 4.3.2 the crash does no longer occur, but when the editor is still active the QTableWidget returns the _old_ value for the cell, since the editor hasn't "commited" the final edit value back (see debug output on console). So, the workaround with moving the focus away to finish all editors is still necessary.

Bye,
Andreas