Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
4.6.3
-
None
-
a2f83283a64460ca26530321f8eb64f3ddfe4c8b
Description
Consider the following code:
struct Node { QList<Node> children; }; int main(int, char**) { QList<Node> nodeList; nodeList << Node(); nodeList = nodeList.first().children; //<< crashes }
The application crashes in the assignment operator of QList. I've done some research and found out, that the list first destroys its content and then do the actual copy operation. But in the example above, the source (nodeList.first().children) is a part of the "old" content of the destination list (nodeList).
Sometimes the code seems to work fine (no crash and desired results) but you get always an error if you run it with a memory analysis tool like valgrind.