Commit d09c247
committed
python: fix dangling pointer and CSX state after Reset/ReadFromXML; add tests
- Reset() now nulls __CSX.thisptr and clears __CSX before calling C++
Reset, preventing the old Python wrapper from holding a freed pointer
- ReadFromXML() clears the Python-side CSX reference inline before
delegating to C++, avoiding an extra C++ Reset() call
- GetCSX() nulls the old wrapper's thisptr when the C++ pointer has
changed unexpectedly, as a safety net against unforeseen state changes
- Add test_getcsx_not_none_after_read and test_getcsx_replaced_after_read
to cover the fix from PR #218 and guard against regressions
Signed-off-by: Thorsten Liebig <thorsten.liebig@gmx.de>
Assisted-by: Claude Sonnet 4.61 parent 1619678 commit d09c247
2 files changed
Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
164 | 197 | | |
165 | 198 | | |
166 | 199 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
118 | 121 | | |
119 | 122 | | |
120 | 123 | | |
| |||
436 | 439 | | |
437 | 440 | | |
438 | 441 | | |
| 442 | + | |
| 443 | + | |
439 | 444 | | |
440 | 445 | | |
441 | 446 | | |
| |||
579 | 584 | | |
580 | 585 | | |
581 | 586 | | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
582 | 590 | | |
0 commit comments