[SOLVED]Is This a Qt BUG?
I am facing something that looks like a qt bug but I need confirmation from someone more qualified. Here it is:
Inside on_tableView_doubleClicked() slot I am closing (delete this;) the tableView parent form (QDialog started with exec()). At this point my application crashes.
When I call on_tableView_doubleClicked() from any other place in my code all is o.k., but if the actual double click happen it crashes.
Interesting thing is that if I postpone closing with QTimer::singleShot(1 ms) all is O.k. This is why I am suspecting that this is Qt bug.
If this looks like Qt bug to you, please encourage my to report it :).
It's not a Qt bug.
// Replace this...
// ...with this:
delete this can cause crashes because you delete the object when it is still trying to process events. deleteLater() will wait for all the events to finish processing -- then it's safe to delete the object.
Always use deleteLater() to delete QObjects, unless you are trying to do low-level memory management. (Most people don't need to do this)
deleteLater() did the trick. Thant you.