free(): invalid pointer when using sorted query with std::list
SimonPierreED opened this issue · comments
Simon PIERRE, EURODECISION commented
Describe the bug
A memory corruption seems to occur when using sorted queries with std::list in any components.
To Reproduce
- Compile the cpp/queries/sorting example with the first lines modified as follow
#include <sorting.h>
#include <iostream>
+#include <list>
struct Position {
double x, y;
+ std::list<char> test;
};
// Order by x member of Position
int compare_position(
[...]
Expected behavior
The example compile and run just fine.
Current behavious
-- First iteration
{1,0}
{2,0}
{4,0}
{5,0}
{6,0}
-- Second iteration
{2,0}
{4,0}
{5,0}
{6,0}
{7,0}
-- System iteration
{2,0}
{3,0}
{4,0}
{5,0}
{6,0}
{7,0}
free(): invalid pointer
Aborted
Additional context
Compiled on windows WSL2 : g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Release and debug cause the same issue.
The list seems to be in a weird state in the destructor.
This is currently completely preventing me from used sorting. But otherwise thanks for the great work!
Sander Mertens commented
Fixed!