Details
-
Bug
-
Resolution: Invalid
-
P1: Critical
-
None
-
5.11.2, 5.12.1
Description
I have a code involving qDeleteAll that was working properly on Qt 4.7.4, but, after going to Qt 5.11.2 and then 5.12.1 (where I hoped the issue was fixed but is still present), the code begin to crash.
Here are the logs where we can see qDeleteAll is jumping through elements, deletes 0 then 2 then crash instead of 0 then 1 then 2 as in Qt 4.7.4 logs below:
Creating: [root] Creating: [i = 0] Creating: [j = 0] Creating: [j = 1] Creating: [j = 2] Deleting: [root] Deleting: [i = 0] Deleting: [j = 0] Deleting: [j = 2] The program has unexpectedly finished.
And the backtrace:
1 ?? 0x31 2 qDeleteAll<QList<Tata *>::const_iterator> qalgorithms.h 320 0x405856 3 qDeleteAll<QList<Tata *>> qalgorithms.h 328 0x405498 4 Tata::~Tata Tata.cpp 16 0x4048aa 5 Tata::~Tata Tata.cpp 23 0x40491a 6 qDeleteAll<QList<Tata *>::const_iterator> qalgorithms.h 320 0x405856 7 qDeleteAll<QList<Tata *>> qalgorithms.h 328 0x405498 8 Tata::~Tata Tata.cpp 16 0x4048aa 9 Tata::~Tata Tata.cpp 23 0x40491a 10 Widget::RunTest Widget.cpp 44 0x403843 11 Widget::Widget Widget.cpp 19 0x40357a 12 main main.cpp 7 0x4033d1
And, as said above, it works fine in Qt 4.7.4, here are the logs:
Created [root] Created [i = 0] Created [j = 0] Created [j = 1] Created [j = 2] Created [i = 1] Created [j = 0] Created [j = 1] Created [j = 2] Deleting [root] Deleting [i = 0] Deleting [j = 0] Deleting [j = 1] Deleting [j = 2] Deleting [i = 1] Deleting [j = 0] Deleting [j = 1] Deleting [j = 2]
And here is the project a made to show this qDeleteAllCrash.zip (note I used a Widget application since it seems not crashing with a console application, even if the logs are the same, showing the deletion of 0 then 2).